Download the PHP package geniusgeeek/pu-converter without Composer
On this page you can find all versions of the php package geniusgeeek/pu-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geniusgeeek/pu-converter
More information about geniusgeeek/pu-converter
Files in geniusgeeek/pu-converter
Package pu-converter
Short Description PU-converter is a simple and an easy to use PHP unit converter library for converting mathematical, engineering and scientific units
License MIT
Informations about the package pu-converter
PU-converter
PU-converter is an easy to use PHP unit converter library for converting S.I units to other compatible unit types. With PU-converter you can easily convert any engineering unit to its different unit types, for example, kilogram to grams, celsius to kelvin, e.t.c. Save your self the math stress and let the PU-converter library handle all conversions for you.
Coverage
PU-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 set
PU-converter can handle a wide range of unit types including:
- Length
- Area
- Volume
- Mass
- Speed
- Temperature
- Pressure
- Time
- Energy/Power
- Disk Storage
- Frequency
- Plane Angles
Installation
Using Composer
PU-converter can be insatlled using composer
without composer
To utilize this class, first import puconverter.php into your project, and instantiate it.
Guidelines: How to use
- Create an object of the class for conversion
- The object propeties should be initialised on object creation
- Parameter 1 is the class for conversion, Parameter 2 is the value to be converted, Parameter 3 is the unit to convert, Parameter 4 is the unit to be converted to
- To return the conversion call the method convert()
- All units are to be passed in their SI units/abbreviations, example: kilogram is kg, seconds is s, e.t.c.
Documentation
Create an object for different conversion class using the syntax below
- $temperature => new PUconverter("temperature", $value, $fromUnit, $toUnit);
- Area => new PUconverter("area", $value, $fromUnit, $toUnit);
- Plane Angles => new PUconverter("angle", $value, $fromUnit, $toUnit);
- Time => new PUconverter("time", $value, $fromUnit, $toUnit);
- Volume => new PUconverter("volume", $value, $fromUnit, $toUnit);
- Speed => new PUconverter("speed", $value, $fromUnit, $toUnit);
- Length => new PUconverter("length", $value, $fromUnit, $toUnit);
- Pressure => new PUconverter("pressure", $value, $fromUnit, $toUnit);
- Mass => new PUconverter("mass", $value, $fromUnit, $toUnit);
- Frequency => new PUconverter("frequency", $value, $fromUnit, $toUnit);
- Energy/Power => new PUconverter("energy", $value, $fromUnit, $toUnit);
- Disk Storage => new PUconverter("storage", $value, $fromUnit, $toUnit);
Simple Examples
//Returns 3000000 meters
//returns 52.143 weeks
Valid Units
Temperature
k => Kelvin
c => celsius
f => fahrenheit
Area
m2 => Square Meter
km2 => Square Kilometer
cm2 => Square Centimeter
mm2 => Square Millimeter
ft2 => Square Foot
mi2 => Square Mile
ac => Acre
ha => hectare
Volume
l => Litre
ml => Millilitre
m3 => Cubic Meter
gal => Gallon
oz => fluid ounces
ft3 => cubic feet
cm3 => cubic centi meter
Mass
kg => Kilogram
g => Gram
mg => Milligram
lb => Pound
t => Tonne
Speed
mps => Meters per Second
kph => Kilometers Per Hour
mph => Miles Per Hour
knots => Knots
Planes Angles
deg => Degrees
rad => Radian
grad => gradian
Pressure
pa => Pascal
kpa => kilopascal
mpa => MegaPascal
bar => Bar
mbar => Millibar
psi => Pound-force per square inch
Time
s => Second
yr => Year
month => Month
week => Week
day => Day
hr => Hour
min => Minute
ms => Millisecond
dec => decade
cen => century
Energy/Power
j => Joule
kj => Kilojoule
gcal => Gram calorie
whr => Watt Hour
kwhr => Kilowatt Hour
ev => Electronvolt
kcal => kilocalorie
Disk Storage
bit => bit
byte => byte
kb => kilobyte
mb => megabyte
gb => gigabyte
tb => terabyte
pb => petabyte
Frequency
hz => hertz
khz => kilo hertz
mhz => mega hertz
ghz => giga hertz
Length
m - Meter
km - Kilometer
cm - Centimeter
mm - Millimeter
um - Micrometer
nm - Nanometer
in - Inch
ft - Foot
yd - Yard
mi - Mile
Author
Initial work- Gracious Emmanuel
Contributors
Ordago: https://github.com/ordago
Contributing
Please, read the contributing.md to see contributing process, code of conduct and pull request process.