PHPackages                             codingmatters/unit-of-measures - 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. codingmatters/unit-of-measures

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

codingmatters/unit-of-measures
==============================

Unit of Measurements as Immutable Objects

00PHPCI failing

Since Apr 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/value-objects/unit-of-measurements)[ Packagist](https://packagist.org/packages/codingmatters/unit-of-measures)[ RSS](/packages/codingmatters-unit-of-measures/feed)WikiDiscussions develop Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Unit of Measures in PHP
=======================

[](#unit-of-measures-in-php)

A library for Unit of Measurements written in PHP.

Installation:

```
composer require codingmatters/unit-of-measures
```

### Units for Mass

[](#units-for-mass)

Using `Weight::class` in measuring the mass. Following are practical usage for the weight object.

```
use CodingMatters\UoM\Weight;

$weightInGrams = Weight::inGrams(1000);
$weightInPounds = Weight::inPounds(250);
$weightInOunce = Weight::inOunch(350);
```

#### Weight In Grams

[](#weight-in-grams)

```
use CodingMatters\UoM\Weight;

$weight = Weight::inGrams(1000); // will return string "1000 g"
$weight->unit(); // will return g
$weight->value(); // will return 1000

/**
 * Available conversion method:
 */
$weightInKilos = $weight->toKilo(); // will return string as "1 kg"
$weightInPounds = $weight->toPounds(); // will return string as ""

// you can still use the unit() and value() methods after conversion
$weightInKilos->unit(); // will return kg
$weightInKilos->value(); // will return 1
```

Contributions
=============

[](#contributions)

Developed by [Gab Amba](https://github.com/gabbydgab) and maintained by [Coding Matters Software Development Services](https://codingmatters.today)

We thank all the [contributors](https://github.com/CodingMatters/community-crisis-response-and-monitoring-system/graphs/contributors) who made this project possible.

Security and Vulnerabilities
============================

[](#security-and-vulnerabilities)

If you discover a security vulnerability within this library, please send an email to Gab Amba via . All security vulnerabilities will be promptly addressed.

License
=======

[](#license)

```
Copyright (C) 2020  Coding Matters Software Development Services

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see .

```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

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/27f2198c3823562b45ef642286a0bca77b6c6c69a3ce206d9eb9e72306233195?d=identicon)[gabbydgab](/maintainers/gabbydgab)

---

Top Contributors

[![gabbydgab](https://avatars.githubusercontent.com/u/1191242?v=4)](https://github.com/gabbydgab "gabbydgab (7 commits)")

### Embed Badge

![Health badge](/badges/codingmatters-unit-of-measures/health.svg)

```
[![Health](https://phpackages.com/badges/codingmatters-unit-of-measures/health.svg)](https://phpackages.com/packages/codingmatters-unit-of-measures)
```

###  Alternatives

[p-chess/chess

A PHP chess library that is used for chess move generation/validation, piece placement/movement, and check/checkmate/stalemate detection

473.3k2](/packages/p-chess-chess)

PHPackages © 2026

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