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

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

konetchy/unit-converter
=======================

A simple tool for converting units of measurement. Forked from skoyah/unit-converter

1.2(6y ago)04MITPHPPHP ^7.1

Since Oct 28Pushed 6y agoCompare

[ Source](https://github.com/konetchy/unit-converter)[ Packagist](https://packagist.org/packages/konetchy/unit-converter)[ RSS](/packages/konetchy-unit-converter/feed)WikiDiscussions master Synced 2mo ago

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

Unit Converter
==============

[](#unit-converter)

Unit Converter is a PHP library that makes unit converting a fairly simple an intuitive process.

Project was forked from the skyoah/unit-converter library.

Table of Contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Basic Usage](#basic-usage)
3. [Support](#support)
4. [Configuration](#configuration)
5. [License](#license)

---

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

[](#installation)

```
$ composer require konetchy/unit-converter
```

Basic Usage
-----------

[](#basic-usage)

### Namespacing

[](#namespacing)

The Unit Converter library is under `Konetchy\Converter` namespace.

Once you have installed the Unit Converter library, converting from one unit of measurement to another is really simple.

First, create a new instance of the desired type and import the related class. The instance needs to accept two parameters - 1) a boolean for the quantity, and 2) a string for the unit of measurement.

Next, all you need is to call a `to()` method and pass in the parameter for the convertion.

### Example conversion:

[](#example-conversion)

```
use Konetchy\Converter\Mass;

$mass = new Mass(1, 'kg');
echo $mass->to('pounds'); // '2.20462262'
```

Alternatively, you can convert using the unit abbreviation as a parameter:

```
echo $mass->to('lbs'); // '2.20462262'
```

The `to()` method has also an optional parameter tor defining how many decimal units should be displayed for the given convertion.

```
echo $mass->to('lbs', 2); // '2.20'
```

Support
-------

[](#support)

Currently, the Unit Converter supports the following types:

- [Mass](#mass-units)
- [Length](#length-units)
- [Pressure](#pressure-units)
- [Area](#area-units) - ***New***

Configuration
-------------

[](#configuration)

During instantiation or convertion, you have two options for defining the unit to be used.

There is a longform and a short-hand word available for each unit of measure.

For consistency, it is **recommended** to use lowercase letters, but if you prefer you can use uppercase letters since during instantiation and/or convertion, the unit of measure will be parsed and formatted to lowercase characters.

### Mass units

[](#mass-units)

longshort*tonnes**t**kilograms**kg**grams**g**milligrams**mg**pounds**lbs**onces**oz*### Length units

[](#length-units)

longshort*kilometers**km**meters**m**decimeters**dm**centimeters**cm**millimeters**mm**inches**in**feet**ft**yards**yd**miles**mi**nautical miles**nmi*### Pressure units

[](#pressure-units)

longshort*bars**bar**millibars**mbar**kilopascals**kpa**pascals**pa**atmospheres**atm*### Area units

[](#area-units)

longshort*square kilometers**km2**square meters**m2**square centimeters**cm2**square millimeters**mm2**square inches**in2**square feet**ft2**square yards**yd2*License
-------

[](#license)

Unit Converter is released under the MIT Licence. Read the [license](https://github.com/konetchy/unit-converter/blob/master/LICENSE.md) file for more details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~55 days

Recently: every ~69 days

Total

6

Last Release

2473d ago

Major Versions

v0.2 → v1.02018-11-04

### Community

Maintainers

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

---

Top Contributors

[![skoyah](https://avatars.githubusercontent.com/u/36083448?v=4)](https://github.com/skoyah "skoyah (50 commits)")[![konetchy](https://avatars.githubusercontent.com/u/28579559?v=4)](https://github.com/konetchy "konetchy (5 commits)")[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (1 commits)")

---

Tags

phpconverterunit-converter

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[skoyah/unit-converter

A simple tool for converting units of measurement.

131.8k](/packages/skoyah-unit-converter)

PHPackages © 2026

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