PHPackages                             laxity7/phpmoney - 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. laxity7/phpmoney

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

laxity7/phpmoney
================

Correct work with money (fiat and crypto) in PHP

1.0.3(1y ago)040MITPHPPHP &gt;=8.1

Since Jun 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/laxity7/phpmoney)[ Packagist](https://packagist.org/packages/laxity7/phpmoney)[ Docs](https://github.com/laxity7/phpmoney)[ RSS](/packages/laxity7-phpmoney/feed)WikiDiscussions master Synced 1mo ago

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

PHP Money
=========

[](#php-money)

PHP library to make working with money with fiat and cryptocurrencies safer and easier!

[![License](https://camo.githubusercontent.com/1ef92b8035ba54254812f119fe36f6f34014f67082114f686704bdba1dda20fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6178697479372f7068706d6f6e65792e737667)](https://github.com/laxity7/phpmoney/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/e050537c876b79a2b8895895ab361fbae33648c6912faca325670fdf828292c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6178697479372f7068706d6f6e65792e737667)](https://packagist.org/packages/laxity7/phpmoney)[![Total Downloads](https://camo.githubusercontent.com/5d1eee0bb54ac0fb0680d83aee41a3ed41adb81b32062b633f109eb6542cf125/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6178697479372f7068706d6f6e65792e737667)](https://packagist.org/packages/laxity7/phpmoney)

Install
-------

[](#install)

Install via composer

```
composer require laxity7/phpmoney
```

Requirements
------------

[](#requirements)

This library requires the [BCMath PHP extension](https://www.php.net/manual/en/book.bc.php).

Version 1.0.0 requires PHP 8.1+. For older version of PHP, use version 0.0.1 of this library, which requires PHP 7.4.

Features
--------

[](#features)

- Fiat and cryptocurrency support
- JSON Serialization
- String representation
- Transparent calculation logic upon availability
- Money formatting
- Currency repositories (ISO currencies and TOP100 cryptocurrencies included)

Usage
-----

[](#usage)

Basic usage example:

```
use Laxity7\Money\Money;
use Laxity7\Money\Currency;

$tenEur = new Money(10.50, 'EUR');
//$tenEur = new Money(10.50, new Currency('EUR')); // the same as above
$twentyOneEur = $tenEur->add($tenEur);
echo $twentyOneEur->getAmount(); // 21
echo $twentyOneEur->getCurrency(); // EUR
echo $twentyOneEur; // 21 EUR
echo json_encode($twentyOneEur); // {"amount":"21","currency":"EUR"}

$btc = new Money(0.00000001, 'BTC');
$eth = new Money(1.01, 'USDT');
$sum = $btc->add($eth); // throws \Laxity7\Money\Exceptions\InvalidArgumentException
```

Configuration example:

```
use Laxity7\Money\Money;
use Laxity7\Money\MoneyConfig;

// You can configure your own currencies only once. You can't change it later.
// Scale is the number of decimal places in the currency (e.g. 2 for USD, 8 for BTC). Max is 14.
MoneyConfig::configure(
    new Currencies([
        ['name' => 'US Dollar', 'symbol' => 'USD', 'scale' => 2],
        ['name' => 'Euro', 'symbol' => 'EUR', 'scale' => 4],
        ['name' => 'MyCoin', 'symbol' => 'MC', 'scale' => 8],
   ]
);

//...
$tenEur = new Money(10.50, 'USD'); // ok
$tenMyCoin = new Money(10.50, 'MyCoin'); // ok
$tenBtc = new Money(10.50, 'BTC'); // throws \Laxity7\Money\Exceptions\UnacceptableCurrencyException
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance42

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Recently: every ~57 days

Total

6

Last Release

465d ago

Major Versions

v0.0.2 → 1.0.02024-11-30

PHP version history (2 changes)0.0.1PHP &gt;=7.4|&gt;=8.0

1.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![laxity7](https://avatars.githubusercontent.com/u/6792144?v=4)](https://github.com/laxity7 "laxity7 (6 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/laxity7-phpmoney/health.svg)

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

PHPackages © 2026

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