PHPackages                             koesie10/unit-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. koesie10/unit-converter

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

koesie10/unit-converter
=======================

v0.1(9y ago)021MITPHPPHP &gt;=7.0

Since Nov 15Pushed 9y agoCompare

[ Source](https://github.com/koesie10/UnitConverter)[ Packagist](https://packagist.org/packages/koesie10/unit-converter)[ RSS](/packages/koesie10-unit-converter/feed)WikiDiscussions master Synced 4w ago

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

PHP Lua Serializer/Deserializer
===============================

[](#php-lua-serializerdeserializer)

[![Build](https://camo.githubusercontent.com/4502cf3bb233a979996beb6b054bfb26748a2a777c7e369f2b263adbd9cf701f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f6b6f6573696531302f556e6974436f6e7665727465722e737667)](https://scrutinizer-ci.com/g/koesie10/UnitConverter)[![Version](https://camo.githubusercontent.com/482bac5bedca9602d1710164142ea47ddf30c62812614090c053c7c787bcb39d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f6573696531302f756e69742d636f6e7665727465722e737667)](https://packagist.org/packages/koesie10/unit-converter)[![License](https://camo.githubusercontent.com/872d302ffef19068929ec8d75004ece94fcba4a9ee34fc5c1414276deadb9907/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b6f6573696531302f756e69742d636f6e7665727465722e737667)](https://packagist.org/packages/koesie10/unit-converter)[![Code Coverage](https://camo.githubusercontent.com/537a16027d44d73078c5189d3989b9b7c75ae97e871aecd2cfd893d7c7e6e02a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6b6f6573696531302f556e6974436f6e7665727465722e737667)](https://scrutinizer-ci.com/g/koesie10/UnitConverter)[![Code Quality](https://camo.githubusercontent.com/1fc5e2f31d73c906341e885ec2229252c6c2aef10d9759b92956ea65050474e8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b6f6573696531302f556e6974436f6e7665727465722e737667)](https://scrutinizer-ci.com/g/koesie10/UnitConverter)[![Downloads](https://camo.githubusercontent.com/dec99e0ab48e4ece89621ab59a39950ba6374f0366ae4ce0b544a81b84f010ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f6573696531302f756e69742d636f6e7665727465722e737667)](https://packagist.org/packages/koesie10/unit-converter)

This is a SI unit converter for PHP, that will convert all kinds of units from one into the other, with support for composite units.

Installation
------------

[](#installation)

Install with [Composer](http://getcomposer.org):

```
composer require koesie10/unit-converter

```

Usage
-----

[](#usage)

Simply create a `\Vlaswinkel\UnitConverter\UnitConverter` object and call the `convert` method:

```
$converter = new \Vlaswinkel\UnitConverter\UnitConverter();

echo $converter->convert('1', 'm/s', 'km/h'); // prints 3.6, as expected
```

This library will try to use BC math if it is available, which is highly recommended for more accurate results. In that case, it is recommended to always supply strings to the convert function, otherwise there will still be floating point errors.

**Note**: If you do not get proper results, check that you have [set the scale](http://php.net/manual/en/bc.configuration.php) for BC math correctly. It is recommended to set the value to at least 3, but for more precision, it is recommended to increase the value more.

If you would like to use the default PHP math functions, which will have floating point errors but will not require a scale, you can instantiate the `UnitConverter` as follows:

```
$converter = new \Vlaswinkel\UnitConverter\UnitConverter(null, new \Vlaswinkel\UnitConverter\Math\DefaultMathWrapper());
```

Running tests
-------------

[](#running-tests)

You can run automated unit tests using [PHPUnit](http://phpunit.de) after installing dependencies:

```
vendor/bin/phpunit

```

License
-------

[](#license)

This library is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

3514d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1112623?v=4)[Koen Vlaswinkel](/maintainers/koesie10)[@koesie10](https://github.com/koesie10)

---

Top Contributors

[![koesie10](https://avatars.githubusercontent.com/u/1112623?v=4)](https://github.com/koesie10 "koesie10 (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/koesie10-unit-converter/health.svg)

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

###  Alternatives

[krizon/php-ga-measurement-protocol

Easy use of the Google Analytics Measurement Protocol in PHP

108587.4k5](/packages/krizon-php-ga-measurement-protocol)[merujan99/laravel-video-embed

Laravel Package for dereuromark/MediaEmbed With Thumbnail

3579.0k](/packages/merujan99-laravel-video-embed)[rasteiner/k3-whenquery

Conditionally show fields and sections. Better.

6619.1k](/packages/rasteiner-k3-whenquery)[chippyash/monad

Functional programming Monad support

2728.4k8](/packages/chippyash-monad)[simonstamm/laravel-pjax

PJAX for Laravel 4 with redirection-support

228.3k](/packages/simonstamm-laravel-pjax)

PHPackages © 2026

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