PHPackages                             commitm/money - 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. commitm/money

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

commitm/money
=============

Money. Money pattern's Implementation

0.3.0(1y ago)018MITPHPPHP ^8.2

Since Mar 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/michalmaterniak/money)[ Packagist](https://packagist.org/packages/commitm/money)[ RSS](/packages/commitm-money/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (15)Used By (0)

Introduction
------------

[](#introduction)

PHP Money pattern's implementation, Martin Fowler [Money pattern by Martin Fowler](http://martinfowler.com/eaaCatalog/money.html).

Usage
-----

[](#usage)

```
composer require commitm/money
```

```
$amount = 100; // 100 = 100 cents = 1 $
$currency = 'USD';

$money = new \Money\Money(new \Money\Amount\Amount($amount), new \Money\Currency\Currency($currency));
// Money class is a value object

$money->getAmount() // return value

$code = $money->getCurrency()->getCode();

$money2 = clone $money; // values $money2 hava the same values like $money, but different objects' references

// comparing
$isEqual = $money->equals($money2); // true
$isCurrenciesTheSame = $money->identicalCurrencies($money2); // true

// math: add, sub, percentage. Value object Money class create a new object
$addMoney = $money->add($money2); // $addMoney->getAmount() === 200
$subMoney = $money->sub($money2); // $subMoney->getAmount() === 0
$sub2Money = $money->sub($money2, $money2); // $sub2Money->getAmount() === -100
// library provide possibility a negative amount
$halfMoney = $money->percent(0.5); // $halfMoney->getAmount() === 50
```

You can override Amount or Currency class with own restricts or validations, make new class and implementin AmountInterface

```
class Amount2 implements \Money\Amount\AmountInterface {
    public function __construct(int $value) {
        // validation or something else
    }
    public function getAmount(): string{
        return ...
    }
}

$money = new \Money\Money(new Amount2(100), new \Money\Currency\Currency('USD'));
```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance48

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Recently: every ~88 days

Total

13

Last Release

384d ago

PHP version history (3 changes)0.0.1PHP ~8.3.0

0.2.1PHP ^8.3

0.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b69710b6d16c6d182bc6a9f714daf419abad0bff954dd68cdabc2fe28ba5c93?d=identicon)[michalmaterniak](/maintainers/michalmaterniak)

---

Top Contributors

[![michalmaterniak](https://avatars.githubusercontent.com/u/25308020?v=4)](https://github.com/michalmaterniak "michalmaterniak (17 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/commitm-money/health.svg)

```
[![Health](https://phpackages.com/badges/commitm-money/health.svg)](https://phpackages.com/packages/commitm-money)
```

###  Alternatives

[devforest/laravel-dynamic-report-generator

A package for dynamic report generation with drag-and-drop interface in Laravel

3112.2k](/packages/devforest-laravel-dynamic-report-generator)

PHPackages © 2026

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