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

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

superbalist/php-money
=====================

A money and currency library for handling arbitrary-precision arithmetic

2.0.0(9y ago)1159.2k↓12%MITPHPPHP &gt;=5.4.0

Since Jan 22Pushed 3y ago39 watchersCompare

[ Source](https://github.com/Superbalist/php-money)[ Packagist](https://packagist.org/packages/superbalist/php-money)[ RSS](/packages/superbalist-php-money/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (10)Used By (0)

php-money
=========

[](#php-money)

A money and currency library for handling arbitrary-precision arithmetic

[![Author](https://camo.githubusercontent.com/abd4e3e2e71081ad01ef09a60c49d70c5e0677497f38918e740703cd02605078/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40737570657262616c6973742d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/superbalist)[![Build Status](https://camo.githubusercontent.com/8c4924c7a0a5995bfd9c62ec56508c6454ef8e2f2e8323bd8702145154be9cf3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f537570657262616c6973742f7068702d6d6f6e65792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Superbalist/php-money)[![StyleCI](https://camo.githubusercontent.com/25f52ea3018ca286e26ff1c4aaa5e1608089ca6f2dcdbdcea1f733c34deac405/68747470733a2f2f7374796c6563692e696f2f7265706f732f35303138303939342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/50180994)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/08c9744675117818c9896857d25a080bf44109139b6afb851bdcb88c4823bad1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737570657262616c6973742f7068702d6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/php-money)[![Total Downloads](https://camo.githubusercontent.com/a3d266a76a19a3d9ea9be9bdb93d984651dd9d6a8f94cb5f19ea6df0f1392a46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737570657262616c6973742f7068702d6d6f6e65792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/php-money)

Installation
------------

[](#installation)

```
composer require superbalist/php-money
```

Usage
-----

[](#usage)

```
use Superbalist\Money\CurrencyConversionServiceProvider;
use Superbalist\Money\CurrencyFactory;
use Superbalist\Money\Money;
use Superbalist\Money\OpenExchangeRatesCurrencyConversionService;

// set default currency conversion service
// this is optional, and is only required if you're going to be converting between currencies
$service = new OpenExchangeRatesCurrencyConversionService('[[insert app id here]]');
CurrencyConversionServiceProvider::setCurrencyConversionService($service);

// set default currency
CurrencyFactory::setDefault('ZAR');

// a money object can be constructed very loosely
$a = new Money(150);
$a = new Money('150'); // recommended
$a = new Money('150.00');
$a = new Money(150.00); // not recommended, as we're trying to avoid using floating points
$a = new Money('150', CurrencyFactory::make('USD'));

// basic operations on numbers
$a = new Money('150.55');
$b = new Money('99.45');
$c = $a->add($b); // 250

$a = new Money('300.00');
$b = new Money('2');
$c = $a->divide($b); // 150

// comparing numbers
$a = new Money('0.33');
$b = new Money('0.33');
$c = $a->equals($b); // true
$c = $a->isGreaterThan($b); // false
$c = $a->isGreaterThanOrEqualTo($b); // true
$c = $a->isLessThan($b); // false

// convert a monetary value from currency A to currency B
$a = new Money('100', CurrencyFactory::make('ZAR'));
$b = $a->toCurrency(CurrencyFactory::make('USD'));

// format a number for display
$a = new Money('123.9999');
echo $a->format(); // 123.99
echo $a->display(); // R123.99

// handling value added tax
$a = new Money('100');
$rate = '0.14';
$b = $a->calculateVat($rate); // 14
$c = $a->add($b); // 114
$d = $c->calculateNetVatAmount($rate); // 100

// min & max
$a = new Money('100');
$b = new Money('101');
$c = $a->max($b); // 101
$d = $a->min($b); // 100

// ...see classes for full list of methods
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~77 days

Recently: every ~115 days

Total

7

Last Release

3302d ago

Major Versions

1.0.5 → 2.0.02017-05-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b8f533cf5a84c29d3860ee32356f0554ead023247638ea952353fc2f01b2e5d?d=identicon)[superbalist](/maintainers/superbalist)

---

Top Contributors

[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (35 commits)")[![shad0wfir3](https://avatars.githubusercontent.com/u/20926935?v=4)](https://github.com/shad0wfir3 "shad0wfir3 (3 commits)")[![nicja](https://avatars.githubusercontent.com/u/2102143?v=4)](https://github.com/nicja "nicja (2 commits)")

---

Tags

arbitrary-precisionbcmathcurrency-librarymoneyphpphp-moneysuperbalist

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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