measurement-unit

A collection of measurement units for easy conversion and typed code (Weight, Volume, Length, Time, Speed & more!)

MIT License

Downloads
7.5K
Stars
10
Committers
1

Measurement-unit

Setup

Note Make sure you are running PHP 8.1 or higher to use this package

To use this package in your project, run the following command:

composer require prinsfrank/measurement-unit

Provided units

Type Available unit
Length Fathom, Foot, Furlong, HorseLength, Inch, Meter, Kilometer, NauticalMile, StatuteMile, SurveyMile, Thou, Yard
Speed KilometerPerHour, Knot, MeterPerSecond, MilesPerHour
Temperature Celsius, Fahrenheit, Kelvin, Rankine
Time Day, Hour, Minute, Second
Torque NewtonMeter
Volume CubicInch, CubicMeter, CubicYard, FluidDram, FluidOunce, Liter, Pint, Quart, TableSpoon
Weight Kilogram, MetricTon, Pound

All the units of a type can be converted to each other with corresponding methods.