Skip to content

Commit

Permalink
updated readme to point to new site
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Jul 30, 2016
1 parent 7edd0bd commit 4761b8e
Showing 1 changed file with 7 additions and 216 deletions.
223 changes: 7 additions & 216 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
![Convertor](http://olifolkerd.github.io/convertor/images/logo.png)

An easy to use PHP unit conversion library.

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

Convertor
================================
Expand All @@ -22,7 +27,7 @@ Convertor can handle a wide range of unit types including:
<li>Energy/Power</li>
</ul>

See [Available Units](#available-units) for full list of units in Convertor.
See [The Documentation](http://olifolkerd.github.io/convertor) for full list of units in Convertor.

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

Expand All @@ -44,218 +49,4 @@ Once you have included the Converter.php library, creating conversions is as sim
$simpleConvertor = new Convertor(10, "m");
$simpleConvertor->to("ft"); //returns converted value
```
10 Meters = 32.808398950131 Feet

Covert to Multiple Units
================================
Once you have setup your Convertor instance you can convert the same value into multiple units by calling the to function multiple times

```php
$multiunitConvertor = new Convertor(10, "m");
$multiunitConvertor->to("km"); //returns converted value in kilometers
$multiunitConvertor->to("ft"); //returns converted value in feet
```
10 Meters:
- km - 0.01
- cm - 1000
- mm - 10000
- mi - 0.0062137119223733
- yd - 10.936132983377
- ft - 32.808398950131


An alternative way to convert multiple units at once is to pass an array of units to the ***to()*** function:
```php
$multiunitConvertor->to(["km","ft","in"]); //returns an array of converted values in kilometers, feet and inches
```

The result of the above function would be
```js
{
"km": 0.01,
"ft": 32.808398950131,
"in": 393.70078740157
}
```



Convert to All Compatible Units
================================
You can convert a value to all compatible units using the ***toAll()*** function
```php
$AllUnitsConvertor = new Convertor(10, "m");
$AllUnitsConvertor->toAll(); //returns all compatible converted value
```

This will return an array containing the conversions for all compatible units, in the case of "meters" as a start unit, Convertor will return all available distance units

```js
{
"m": 10,
"km": 0.01,
"dm": 100,
"cm": 1000,
"mm": 10000,
"μm": 10000000,
"nm": 10000000000,
"pm": 10000000000000,
"in": 393.70078740157,
"ft": 32.808398950131,
"yd": 10.936132983377,
"mi": 0.0062137119223733
}
```



List All Available Units
================================
You can generate a list of all compatible units using the ***getUnits()*** function.
```php
$getUnitsConvertor = new Convertor();
$getUnitsConvertor->getUnits("m"); //returns converted value
```

This will return an array of all available units compatible with the specified unit:
```js
[
"m",
"km",
"dm",
"cm",
"mm",
"μm",
"nm",
"pm",
"in",
"ft",
"yd",
"mi"
]
```

Change From Value
================================
You can change the value and unit you are converting from at any point using the ***from()*** function.
```php
$fromChangeConvertor = new Convertor(10,"m");
$fromChangeConvertor->to("ft"); //returns converted value in feet
$fromChangeConvertor->from(5.23,"km"); //sets new from value in new unit
$fromChangeConvertor->to("mi"); //returns converted new value in miles
```

10 Meters = 32.808398950131 Feet


5.23 Kilometers = 3.2497713354013 Miles


Result Precision
================================
The precision of the results can be set using two optional paramerters in the ***to()*** function to specify the decimal precision and use of rounding.
```php
$precisionConvertor->to("ft", 4, true);
```
The second parameter specifies the decimal precision of the result, the third parameter indicates wheather the result syhould be rounded (***true***, *default value*) or truncated (***false***).

10 Meters = 32.8084 Feet (rounded to 4 decimal places)


Available Units
================================


###Length
- m - Meter
- km - Kilometer
- dm - Decimeter
- cm - Centimeter
- mm - Milimeter
- μm - Micrometer
- nm - Nanometer
- pm - Picometer
- in - Inch
- ft - Foot
- yd - Yard
- mi - Mile
- h - Hand
- ly - LightYear
- au - Astronomical Unit
- pc - Parsec

###Area
- m2 - Square Meter
- km2 - Square Kilometer
- cm2 - Square Centimeter
- mm2 - Square Milimeter
- ft2 - Square Foot
- mi2 - Square Mile
- ac - Acre
- ha - hectare

###Volume
- l - Litre
- ml - Mililitre
- m3 - Cubic Meter
- pt - Pint
- gal - Galon

###Weight
- kg - Kilogram
- g - Gram
- mg - Miligram
- N - Newton *(based on earth gravity)*
- st - Stone
- lb - Pound
- oz - Ounce
- t - Metric Tonne
- ukt - UK Long Ton
- ust - US short Ton

###Speed
- mps - Meters per Second
- kph - Kilometers Per Hour
- mph - Miles Per Hour

###Rotation
- deg - Degrees
- rad - Radian

###Temperature
- k - Kelvin
- c - Centigrade
- f - Fahrenheit

###Pressure
- pa - Pascal
- kpa - kilopascal
- mpa - MegaPascal
- bar - Bar
- mbar - Milibar
- psi - Pound-force per square inch


###Time
- s - Second
- year - *Year (365 days)*
- month - Month *(31 days)*
- week - Week
- day - Day
- hr - Hour
- min - Minute
- ms - Milisecond
- μs - Microsecond
- ns - Nanosecond

###Energy/Power
- j - Joule
- kj - Kilojoule
- mj - Megajoule
- cal - Calorie
- Nm - Newton Meter
- ftlb - Foot Pound
- whr - Watt Hour
- kwhr - Kilowatt Hour
- mwhr - Megawatt Hour
- mev - Mega Electron Volt
10 Meters = 32.808398950131 Feet

0 comments on commit 4761b8e

Please sign in to comment.