Skip to content

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

License

Notifications You must be signed in to change notification settings

PrinsFrank/measurement-unit

Repository files navigation

Banner

Measurement-unit

GitHub PHP Version Support codecov

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, 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.