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

[leafo/lessphp

lessphp is a compiler for LESS written in PHP.

2.2k8.2M141](/packages/leafo-lessphp)[realrashid/sweet-alert

Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library.

1.2k2.9M21](/packages/realrashid-sweet-alert)[symfony/polyfill-php55

Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions

10731.7M9](/packages/symfony-polyfill-php55)[helmich/typo3-typoscript-lint

Static code analysis for the TypoScript configuration language.

902.9M241](/packages/helmich-typo3-typoscript-lint)[cyclonedx/cyclonedx-php-composer

Creates CycloneDX Software Bill-of-Materials (SBOM) from PHP Composer projects

821.6M17](/packages/cyclonedx-cyclonedx-php-composer)[kartik-v/yii2-widget-touchspin

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle touchspines (sub repo split from yii2-widgets)

184.1M6](/packages/kartik-v-yii2-widget-touchspin)

PHPackages © 2026

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