PHPackages                             geniusgeeek/pu-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. geniusgeeek/pu-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

geniusgeeek/pu-converter
========================

PU-converter is a simple and an easy to use PHP unit converter library for converting mathematical, engineering and scientific units

1.0.2(4y ago)3341MITPHPPHP ^7.0CI failing

Since May 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/GeniusGeeek/pu-converter)[ Packagist](https://packagist.org/packages/geniusgeeek/pu-converter)[ RSS](/packages/geniusgeeek-pu-converter/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

[![License](https://camo.githubusercontent.com/a5e3f19ef0a6cae8741281aaeacf71f99646efdd495b7df94b618b3790cfa087/687474703a2f2f706f7365722e707567782e6f72672f67656e697573676565656b2f70752d636f6e7665727465722f6c6963656e7365)](https://packagist.org/packages/geniusgeeek/pu-converter) [![build status](https://camo.githubusercontent.com/bd378b0597aab59af48f4597d4baff66546bf9716a02ac93bea2d8015ff75ffa/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f6261646765732f736869656c64732f6d6173746572)](https://camo.githubusercontent.com/bd378b0597aab59af48f4597d4baff66546bf9716a02ac93bea2d8015ff75ffa/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f6261646765732f736869656c64732f6d6173746572)

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
========

[](#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
------------

[](#installation)

Using Composer
--------------

[](#using-composer)

PU-converter can be insatlled using composer

```
composer require geniusgeeek/pu-converter
```

without composer
----------------

[](#without-composer)

To utilize this class, first import puconverter.php into your project, and instantiate it.

```
include '/path/to/puconverter.php';
use  unitConverter\puconverter\PUconverter;
```

Guidelines: How to use
----------------------

[](#guidelines-how-to-use)

1. Create an object of the class for conversion
2. The object propeties should be initialised on object creation
3. 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
4. To return the conversion call the method convert()
5. All units are to be passed in their SI units/abbreviations, example: kilogram is kg, seconds is s, e.t.c.

Documentation
=============

[](#documentation)

Create an object for different conversion class using the syntax below
----------------------------------------------------------------------

[](#create-an-object-for-different-conversion-class-using-the-syntax-below)

1. $temperature =&gt; new PUconverter("temperature", $value, $fromUnit, $toUnit);
2. Area =&gt; new PUconverter("area", $value, $fromUnit, $toUnit);
3. Plane Angles =&gt; new PUconverter("angle", $value, $fromUnit, $toUnit);
4. Time =&gt; new PUconverter("time", $value, $fromUnit, $toUnit);
5. Volume =&gt; new PUconverter("volume", $value, $fromUnit, $toUnit);
6. Speed =&gt; new PUconverter("speed", $value, $fromUnit, $toUnit);
7. Length =&gt; new PUconverter("length", $value, $fromUnit, $toUnit);
8. Pressure =&gt; new PUconverter("pressure", $value, $fromUnit, $toUnit);
9. Mass =&gt; new PUconverter("mass", $value, $fromUnit, $toUnit);
10. Frequency =&gt; new PUconverter("frequency", $value, $fromUnit, $toUnit);
11. Energy/Power =&gt; new PUconverter("energy", $value, $fromUnit, $toUnit);
12. Disk Storage =&gt; new PUconverter("storage", $value, $fromUnit, $toUnit);

**Simple Examples**

```
use  unitConverter\puconverter\PUconverter;
$length = new PUconverter("length", 3000, 'km', 'm');
echo $length->convert(); //this converts 3000 kilometers to its equivalent meter
```

//Returns 3000000 meters

```
use  unitConverter\puconverter\PUconverter;
$time = new PUconverter("time", 1, 'yr', 'week');
echo $time->convert(); // this converts 1 year to its equivalent time in weeks
```

//returns 52.143 weeks

Valid Units
-----------

[](#valid-units)

**Temperature**
k =&gt; Kelvin
c =&gt; celsius
f =&gt; fahrenheit

**Area**
m2 =&gt; Square Meter
km2 =&gt; Square Kilometer
cm2 =&gt; Square Centimeter
mm2 =&gt; Square Millimeter
ft2 =&gt; Square Foot
mi2 =&gt; Square Mile
ac =&gt; Acre
ha =&gt; hectare

**Volume**
l =&gt; Litre
ml =&gt; Millilitre
m3 =&gt; Cubic Meter
gal =&gt; Gallon
oz =&gt; fluid ounces
ft3 =&gt; cubic feet
cm3 =&gt; cubic centi meter

**Mass**
kg =&gt; Kilogram
g =&gt; Gram
mg =&gt; Milligram
lb =&gt; Pound
t =&gt; Tonne

**Speed**
mps =&gt; Meters per Second
kph =&gt; Kilometers Per Hour
mph =&gt; Miles Per Hour
knots =&gt; Knots

**Planes Angles**
deg =&gt; Degrees
rad =&gt; Radian
grad =&gt; gradian

**Pressure**
pa =&gt; Pascal
kpa =&gt; kilopascal
mpa =&gt; MegaPascal
bar =&gt; Bar
mbar =&gt; Millibar
psi =&gt; Pound-force per square inch

**Time**
s =&gt; Second
yr =&gt; Year
month =&gt; Month
week =&gt; Week
day =&gt; Day
hr =&gt; Hour
min =&gt; Minute
ms =&gt; Millisecond
dec =&gt; decade
cen =&gt; century

**Energy/Power**
j =&gt; Joule
kj =&gt; Kilojoule
gcal =&gt; Gram calorie
whr =&gt; Watt Hour
kwhr =&gt; Kilowatt Hour
ev =&gt; Electronvolt
kcal =&gt; kilocalorie

**Disk Storage**
bit =&gt; bit
byte =&gt; byte
kb =&gt; kilobyte
mb =&gt; megabyte
gb =&gt; gigabyte
tb =&gt; terabyte
pb =&gt; petabyte

**Frequency**
hz =&gt; hertz
khz =&gt; kilo hertz
mhz =&gt; mega hertz
ghz =&gt; giga hertz

**Length**
m - Meter
km - Kilometer
cm - Centimeter
mm - Millimeter
um - Micrometer
nm - Nanometer
in - Inch
ft - Foot
yd - Yard
mi - Mile

Author
------

[](#author)

*Initial work- Gracious Emmanuel*

Contributors
------------

[](#contributors)

Ordago:

Contributing
------------

[](#contributing)

Please, read the **contributing.md** to see contributing process, code of conduct and pull request process.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Total

3

Last Release

1750d ago

PHP version history (2 changes)v1.0PHP ^7.1

1.0.2PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/83fa5aa684fa0b10c2069573590dd59db737501f99c9f66c68a24b909ac5cc80?d=identicon)[geniusgeek](/maintainers/geniusgeek)

---

Top Contributors

[![GeniusGeeek](https://avatars.githubusercontent.com/u/49352277?v=4)](https://github.com/GeniusGeeek "GeniusGeeek (75 commits)")[![ordago](https://avatars.githubusercontent.com/u/6376814?v=4)](https://github.com/ordago "ordago (14 commits)")[![SebKay](https://avatars.githubusercontent.com/u/1873695?v=4)](https://github.com/SebKay "SebKay (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geniusgeeek-pu-converter/health.svg)

```
[![Health](https://phpackages.com/badges/geniusgeeek-pu-converter/health.svg)](https://phpackages.com/packages/geniusgeeek-pu-converter)
```

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
