PHPackages                             ak868308/yii2-unitconverter - 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. ak868308/yii2-unitconverter

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

ak868308/yii2-unitconverter
===========================

This converter allows you to convert any unit to any other compatible unit type

06PHP

Since Feb 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ak868308/yii2-unitconverter)[ Packagist](https://packagist.org/packages/ak868308/yii2-unitconverter)[ RSS](/packages/ak868308-yii2-unitconverter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Unit Converter
===================

[](#yii2-unit-converter)

This converter allows you to convert any unit to any other compatible unit type An easy to use PHP unit conversion library Converter allows you to convert any unit to any other compatible unit type. Convertor can handle a wide range of unit types including: Length, Area, Volume, Weight, Speed, Rotation, Temperature, Pressure, Time, Energy/Power

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

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist ak868308/yii2-unitconverter "*"

```

or add

```
"ak868308/yii2-unitconverter": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, initialize your component, add the following line in config/main.php

```
'components' => [
    'unitconverter' => [
         'class' => '\ak868308\unitconverter\UnitConverter'
    ]
]

```

Finally you are very close to use, simply use it in your code by :

```

```

Using another file somewhere in the project:

```

```

Using the name of the file in config:

```
```

```

Define own units inline:

```
$arr = [
     "m" => array("base" => "m", "conversion" => 1),
     "km" => array("base" => "m", "conversion" => 1000),
];

```

Currently two Unit files are available - one containing the owner's notation and the other one a more formal notation. Differences in notation: Variant km² kg/m² FileName owner 'km2' - BaseUnits.php formal 'km**2' 'kg m**-2' Units.php

Additionally the Units.php file contains area-density definitions.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/184ab37559aa25cef15804467168740c6e5687940d4b1d50a218333bb06e7815?d=identicon)[ak868308](/maintainers/ak868308)

---

Top Contributors

[![ak868308](https://avatars.githubusercontent.com/u/7982249?v=4)](https://github.com/ak868308 "ak868308 (8 commits)")

### Embed Badge

![Health badge](/badges/ak868308-yii2-unitconverter/health.svg)

```
[![Health](https://phpackages.com/badges/ak868308-yii2-unitconverter/health.svg)](https://phpackages.com/packages/ak868308-yii2-unitconverter)
```

###  Alternatives

[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

688126.8M194](/packages/react-stream)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[mageplaza/module-core

Mageplaza Core for Magento 2

7910.7M53](/packages/mageplaza-module-core)

PHPackages © 2026

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