Download the PHP package org_heigl/converter without Composer
On this page you can find all versions of the php package org_heigl/converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download org_heigl/converter
More information about org_heigl/converter
Files in org_heigl/converter
Package converter
Short Description Convert from and to almost anything
License MIT
Informations about the package converter
========= Converter
Converter is a PHP library that allows easy conversion between different metrics of a kind.
Conversion between meter and millimeter might be easy and can be implemented over and over again, but what about the conversion from millimeter to nautical miles? Or what about converting latitude/longitude to UTM? Or what about converting degree Farenheit to Kelvin?
The answer is easy: Use this Converter
Requirements
- PHP in version 5.3
- Nothing else
Installation
- Put the Converter-Folder wherever you like and include that location into your include path.
- If you do not use an autoloader, you should do so!
Usage
Have a look at this example-code to convert from Nautical Miles to yards.
::
$miles = 12; $from = new \Converter\Length\NauticalMiles(); $to = new \Converter\Length\Yard(); $miles2Yard = \Converter\Converter::factory($from, $to);
echo $miles2Yard->convert($miles); // 24304.461942257
So a once defined Converter-Object can be reused as often as you like.
How does it work
Clearly by magic. everything else would not be sophisticated enough.....
For those of you that do not believe in magic, the explanation is quite simple. Converter uses an internal measure to and from which everything is converted.
So in the previous example the Converter calls Length\NauticalMiles to convert the input to the internal measure and hands that over to Length\BritishYard to convert the internal measure to british yards.
Normaly the internal measure is one of the international standard measurements so for lengths the internal measure is meter.
For an overview have a look at the following list:
:Length: meter :Area: squaremeter :Volume: cubicmeter :Geographical: Latitude/Longitude/Height above NN :Temperature: Kelvin :Color: CIELAB