/convertor

A PHP unit conversion library

Primary LanguagePHPMIT LicenseMIT

Convertor

An easy to use PHP unit conversion library.

Full documentation & demos can be found at: http://olifolkerd.github.io/convertor

Convertor

An easy to use PHP unit conversion library.

Converter allows you to convert any unit to any other compatible unit type.

It has no external dependencies, simply include the library in your project and you're away!

Convertor can handle a wide range of unit types including:

  • Length
  • Area
  • Volume
  • Weight
  • Speed
  • Rotation
  • Temperature
  • Pressure
  • Time
  • Energy/Power

See The Documentation for full list of units in Convertor.

If you need aditional unit types, then it is easy to add your own.

Setup

Setting up Convertor could not be simpler.

Include the library

include("Convertor.php");

Simple Example

Once you have included the Converter.php library, creating conversions is as simple as creating an instance of the Convertor with the value to convert from, then specifying the new units

$simpleConvertor = new Convertor(10, "m");
$simpleConvertor->to("ft"); //returns converted value

10 Meters = 32.808398950131 Feet