PHPackages                             olifolkerd/convertor - 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. olifolkerd/convertor

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

olifolkerd/convertor
====================

An easy to use PHP unit conversion library.

2.0.0(5y ago)014.9k↓56.1%[1 PRs](https://github.com/f1e/convertor/pulls)MITPHPPHP ^7.1

Since Dec 9Pushed 2y agoCompare

[ Source](https://github.com/f1e/convertor)[ Packagist](https://packagist.org/packages/olifolkerd/convertor)[ RSS](/packages/olifolkerd-convertor/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (1)Versions (2)Used By (0)

[![Convertor](https://camo.githubusercontent.com/d920741662f47a255b4601070af7298aac804e2cd3de08c7978aa0631360c363/687474703a2f2f6f6c69666f6c6b6572642e6769746875622e696f2f636f6e766572746f722f696d616765732f6c6f676f2e706e67)](https://camo.githubusercontent.com/d920741662f47a255b4601070af7298aac804e2cd3de08c7978aa0631360c363/687474703a2f2f6f6c69666f6c6b6572642e6769746875622e696f2f636f6e766572746f722f696d616765732f6c6f676f2e706e67)

An easy to use PHP unit conversion library.

Full documentation &amp; demos can be found at:

Warning
=======

[](#warning)

This is a fork of original convertor package by `olifolkerd`. I have released latest changes into 2.0 package to achieve "stable" dependency. This package has also been published to packagist, so if you intend to use original source code, make sure you follow exact setup steps.

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

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

Setup
=====

[](#setup)

Setting up Convertor could not be simpler by using Composer. Add the following to your `composer.json` file:

```
"repositories": [
	...
	{
		"type": "vcs",
		"url": "https://github.com/olifolkerd/convertor"
	}
	...
],
"require": {
	...
	"olifolkerd/convertor": "dev-master",
	...
}

```

Simple Example
==============

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

Define your own Units
=====================

[](#define-your-own-units)

Convertor now supports using different files that contain the unit conversions by specifying either the path to the file containing the unit array or the filename of the file in `src/config`directly:

```
//using the default file in `src/Config/Units.php`:
$c=new Convertor(100,"mps");
//using another file somewhere in the project:
$c=new Convertor(100,"mps",'/path/to/my/own/Units.php');
//using the name of the file in conf:
$c=new Convertor(100,"mps",'BaseUnits.php');
//define own units inline
$arr = [
    "m" => array("base" => "m", "conversion" => 1),
    "km" => array("base" => "m", "conversion" => 1000),
];

$c = new Convertor(1, 'm', $arr);
```

Currently two Unit files are available - one containing the owner's notation and the other one a more formal notation. Differences in notation:

Variantkm²kg/m²FileNameowner'km2'-`BaseUnits.php`formal'km\*\*2''kg m\*\*-2'`Units.php`Additionally the `Units.php` file contains area-density definitions.

Resources
=========

[](#resources)

- PHP-Skeleton as a template for the autoloading structure: [github](https://github.com/petk/php-skeleton)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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

Unknown

Total

1

Last Release

2034d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3cc56675ed3e78a1b2f44e58b647a8c38bd41a8181e4d72460eb90ce0d88ceb?d=identicon)[f1e](/maintainers/f1e)

---

Top Contributors

[![olifolkerd](https://avatars.githubusercontent.com/u/6840524?v=4)](https://github.com/olifolkerd "olifolkerd (49 commits)")[![FrontEndCoffee](https://avatars.githubusercontent.com/u/16303480?v=4)](https://github.com/FrontEndCoffee "FrontEndCoffee (6 commits)")[![f1e](https://avatars.githubusercontent.com/u/6922156?v=4)](https://github.com/f1e "f1e (2 commits)")[![Curtisdhi](https://avatars.githubusercontent.com/u/499438?v=4)](https://github.com/Curtisdhi "Curtisdhi (2 commits)")[![marcobax](https://avatars.githubusercontent.com/u/2600040?v=4)](https://github.com/marcobax "marcobax (2 commits)")[![FWidm](https://avatars.githubusercontent.com/u/3480240?v=4)](https://github.com/FWidm "FWidm (1 commits)")[![scotthavens](https://avatars.githubusercontent.com/u/7975741?v=4)](https://github.com/scotthavens "scotthavens (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/olifolkerd-convertor/health.svg)

```
[![Health](https://phpackages.com/badges/olifolkerd-convertor/health.svg)](https://phpackages.com/packages/olifolkerd-convertor)
```

###  Alternatives

[drupal-code-builder/drupal-code-builder-drush

Provides Drush commands for generating Drupal code using Drupal Code Builder.

1337.3k1](/packages/drupal-code-builder-drupal-code-builder-drush)[digitv/yii2bootstrap4

Yii2 Bootstrap 4 widgets

142.5k](/packages/digitv-yii2bootstrap4)

PHPackages © 2026

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