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

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

xxzeroxx/unit-converter
=======================

PHP library for converting units.

v2.0.0(2mo ago)215MITPHPPHP ^8.0CI passing

Since May 15Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/AntonioCarioca/unit-converter)[ Packagist](https://packagist.org/packages/xxzeroxx/unit-converter)[ Docs](https://github.com/AntonioCarioca/unit-converter)[ RSS](/packages/xxzeroxx-unit-converter/feed)WikiDiscussions main Synced today

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

📏 UnitConverter
===============

[](#-unitconverter)

**UnitConverter** is a simple and robust PHP library for converting units of measurement. It supports conversions between lengths, masses, volumes, temperatures and areas. Useful in scientific and educational applications, or any project that requires the manipulation of units.

[![PHP Version](https://camo.githubusercontent.com/aad484e00fb351cf0422a5593ac12c9e59674716481a53430859d4f1a3221e51/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/aad484e00fb351cf0422a5593ac12c9e59674716481a53430859d4f1a3221e51/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![Packagist Version](https://camo.githubusercontent.com/53c7590b66a1c85b308ad558eae7b999fe8245527f509603d1cdbb2281f79fc5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78787a65726f78782f756e69742d636f6e7665727465723f7365727665723d68747470732533412532462532467061636b61676973742e6f7267267374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/53c7590b66a1c85b308ad558eae7b999fe8245527f509603d1cdbb2281f79fc5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78787a65726f78782f756e69742d636f6e7665727465723f7365727665723d68747470732533412532462532467061636b61676973742e6f7267267374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)[![GitHub Release](https://camo.githubusercontent.com/e5ef2eee33fbef26f1c1093a4d08c43f66853af7c39179d83ed597c1477be62f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f416e746f6e696f436172696f63612f756e69742d636f6e7665727465723f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/e5ef2eee33fbef26f1c1093a4d08c43f66853af7c39179d83ed597c1477be62f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f416e746f6e696f436172696f63612f756e69742d636f6e7665727465723f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)[![GitHub License](https://camo.githubusercontent.com/93aa45f45d4857e01d7c4c85bd5a1caf9178865b24cd7fa68e453a4a7e91a801/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416e746f6e696f436172696f63612f756e69742d636f6e7665727465723f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/93aa45f45d4857e01d7c4c85bd5a1caf9178865b24cd7fa68e453a4a7e91a801/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416e746f6e696f436172696f63612f756e69742d636f6e7665727465723f7374796c653d666f722d7468652d6261646765)[![Tests](https://camo.githubusercontent.com/666037abae96766400799457db18d2f53360e1b17718ff2ac2141571d20b95a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e746f6e696f436172696f63612f756e69742d636f6e7665727465722f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666f722d7468652d6261646765266c6162656c3d5465737473266c6162656c436f6c6f723d343835343630)](https://github.com/AntonioCarioca/unit-converter/actions/workflows/tests.yml)

🚀 Features
----------

[](#-features)

- Length conversion (mm, cm, m, km)
- Mass conversion (g, kg, t)
- Volume conversion (ml, l, m³)
- Temperature conversion (C, F, K)
- Area conversion (m², cm², km²)
- Simple and intuitive API
- Lightweight and dependency-free
- Fully tested with PHPUnit
- PHP 8+ support

---

⚠️ Breaking Changes (v2.0.0)
----------------------------

[](#️-breaking-changes-v200)

- Dropped support for PHP 7.x
- Minimum required PHP version is now **8.0**

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require xxzeroxx/unit-converter
```

📖 Usage
-------

[](#-usage)

```
require 'vendor/autoload.php';

use UnitConverter\UnitConverter;

$converter = new UnitConverter();

// Length
echo $converter->convertLength(1, 'km', 'm'); // 1000

// Mass
echo $converter->convertMass(1000, 'g', 'kg'); // 1

// Volume
echo $converter->convertVolume(1, 'm³', 'l'); // 1000

// Temperature
echo $converter->convertTemperature(0, 'C', 'F'); // 32

// Area
echo $converter->convertArea(1, 'm²', 'cm²'); // 10000
```

❗ Error Handling
----------------

[](#-error-handling)

The library throws exceptions for invalid units:

```
$converter->convertLength(10, 'invalid', 'm');
```

🧪 Running Tests
---------------

[](#-running-tests)

```
composer test
```

📜 Changelog
-----------

[](#-changelog)

See [CHANGELOG.md](CHANGELOG.md) for version history.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome!

1. Fork the project
2. Create your feature branch
3. Commit your changes
4. Push to your branch
5. Open a Pull Request

📄 License
---------

[](#-license)

This project is licensed under the MIT License.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Every ~173 days

Total

3

Last Release

69d ago

Major Versions

v1.0.1 → v2.0.02026-04-26

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1340788?v=4)[XxZeroxX](/maintainers/XxZeroxX)[@XxZeroxX](https://github.com/XxZeroxX)

---

Top Contributors

[![AntonioCarioca](https://avatars.githubusercontent.com/u/94471657?v=4)](https://github.com/AntonioCarioca "AntonioCarioca (18 commits)")

---

Tags

composerpackagistphp-library

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[iben12/laravel-statable

Statable trait for Laravel Eloquent models

96318.9k1](/packages/iben12-laravel-statable)[aaronvangeffen/awstatsparser

A series of classes to help read and merge Awstats data files

113.0k](/packages/aaronvangeffen-awstatsparser)

PHPackages © 2026

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