PHPackages                             pleets/units-of-measurement - 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. pleets/units-of-measurement

ActiveLibrary

pleets/units-of-measurement
===========================

PHP Units of Measurement

v0.2.0(4y ago)0102MITPHP

Since Nov 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/pleets/units-of-measurement)[ Packagist](https://packagist.org/packages/pleets/units-of-measurement)[ Docs](https://pleets.org)[ RSS](/packages/pleets-units-of-measurement/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Units of Measurement
====================

[](#units-of-measurement)

This project collects some units of measurement and encapsulates symbols and names in simple constant classes. Some behavior was added to handle and interact with it in a more comfortable way.

In this version, the following units were implemented:

- Time (s, m, h, ...)
- Information (B, KB, MB, ...)

Installation
============

[](#installation)

Use following command to install this library:

```
composer require pleets/units-of-measurement
```

Usage
=====

[](#usage)

Displaying Units and Symbols
----------------------------

[](#displaying-units-and-symbols)

You can get the name of a unit of measurement as follows

```
use Pleets\Units\Symbols\TimeSymbol;
use Pleets\Units\Units\TimeUnit;
use Pleets\Units\Symbols\InformationSymbol;
use Pleets\Units\Units\InformationUnit;

// second
$symbol = TimeUnit::fromSymbol(TimeSymbol::SECOND);

// kilobyte
$symbol = InformationUnit::fromSymbol(InformationSymbol::KILOBYTE);
```

As the same way, you can get the symbol of a unit measurement as follows

```
use Pleets\Units\Symbols\TimeSymbol;
use Pleets\Units\Units\TimeUnit;
use Pleets\Units\Symbols\InformationSymbol;
use Pleets\Units\Units\InformationUnit;

// s
$symbol = TimeSymbol::fromUnit(TimeUnit::SECOND);

// KB
$symbol = InformationSymbol::fromUnit(InformationUnit::KILOBYTE);
```

Grouping Units and Symbols
--------------------------

[](#grouping-units-and-symbols)

You can group as units as you need in the following way.

```
use Pleets\Units\Units\TimeUnit;
use Pleets\Units\Units\Sets\TimeUnitSet;

$timeSet = new TimeUnitSet();
$timeSet->addUnit(TimeUnit::MINUTE);
$timeSet->addUnit(TimeUnit::HOUR);

// ['minute', 'hour']
$units = $timeSet->toArray();
```

As the same way, you can group as symbols as you need in the following way.

```
use Pleets\Units\Symbols\TimeSymbol;
use Pleets\Units\Symbols\Sets\TimeSymbolSet;

$timeSet = new TimeSymbolSet();
$timeSet->addSymbol(TimeSymbol::MINUTE);
$timeSet->addSymbol(TimeSymbol::HOUR);

// ['min', 'h']
$symbols = $timeSet->toArray();
```

Conversions
-----------

[](#conversions)

You can convert between units using the main class of each unit.

```
use Pleets\Units\Time;

$time = Time::fromUnit('minute', 5);

// 300s
$time->toMinutes()->toString();

// 300 seconds
$time->toString(false);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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 ~262 days

Total

2

Last Release

1755d ago

### Community

Maintainers

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

---

Top Contributors

[![darioriverat](https://avatars.githubusercontent.com/u/5879790?v=4)](https://github.com/darioriverat "darioriverat (26 commits)")

---

Tags

unitsunits-converterunits-of-measurementphpsi unitsUnits of Measurement

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pleets-units-of-measurement/health.svg)

```
[![Health](https://phpackages.com/badges/pleets-units-of-measurement/health.svg)](https://phpackages.com/packages/pleets-units-of-measurement)
```

###  Alternatives

[paddlehq/paddle-php-sdk

Paddle's PHP SDK for Paddle Billing.

53301.7k](/packages/paddlehq-paddle-php-sdk)[averias/phpredis-json

A PHP client for RedisJSON module using phpredis extension

3429.3k](/packages/averias-phpredis-json)[averias/phpredis-bloom

PHP client for RedisBloom module using phpredis extension

223.4k](/packages/averias-phpredis-bloom)

PHPackages © 2026

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