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

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

usmanzahid/money-utils
======================

A utility library for accurate and consistent money calculations in PHP without rounding errors.

v1.0.0(1y ago)122MITPHPPHP &gt;=8.1CI passing

Since May 6Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Financial Calculations Utilities
================================

[](#financial-calculations-utilities)

[![Build Status](https://github.com/usmanzahidcode/money-utils/actions/workflows/tests.yml/badge.svg)](https://github.com/usmanzahidcode/money-utils)[![Latest Stable Version](https://camo.githubusercontent.com/ae1cdcb52bf94292cdefe8c6315082ede23dd6e15ff201ccbc4a2a8933b9f655/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f75736d616e7a616869642f6d6f6e65792d7574696c73)](https://packagist.org/packages/usmanzahid/money-utils)[![License](https://camo.githubusercontent.com/2c852064a8c21c58b7da149554f1617b99283ff85799d13745ebe05c5f955af3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f75736d616e7a616869642f6d6f6e65792d7574696c73)](https://packagist.org/packages/usmanzahid/money-utils)

A minimalist utility library for **precise**, **reliable**, and **configurable** financial computations.
Built specifically for financial workflows where **rounding accuracy** and **consistency** matter most.

This library is designed to eliminate the common pitfalls in financial calculations—like **precision errors**, **rounding discrepancies**, and **accumulation anomalies**—by handling all of it **automatically** for you.

Key Features
------------

[](#key-features)

- Define your **desired rounding precision** once.
- Perform all calculations with confidence—the library handles **intermediate precision** and rounds only when appropriate.
- Say goodbye to manually rounding every step or remembering when to round—**just pass your values in**, and the library takes care of the rest.
- Powered by **BCMath** under the hood to ensure **high-precision** arithmetic.

Ideal for developers who want to **avoid hidden rounding bugs** and ensure consistent output across their entire financial system.

Important Disclaimer
--------------------

[](#important-disclaimer)

This library is not a magical fix for flawed system design. It will handle **rounding** and **precision** reliably, but it won’t compensate for **structural inconsistencies** or ambiguous business logic.

**For Example:**
If your system operates in USD but you're working with values like `"0.015" + "0.015" = "0.030"`, you’ll run into issues when rounding for display (`0.02 + 0.02 ≠ 0.03`).
This isn’t a bug in calculation—it’s a mismatch in your rounding strategy or design assumptions.

Best Practices
--------------

[](#best-practices)

To get the most from this library and avoid common pitfalls:

- Clearly define the **monetary units** and rules your system follows.
- Set and enforce **precision levels** based on the currency in use.
- Never use **floats**—always use **strings** for financial values.

[Docs &amp; Usage](./DocsAndUsage.md)
[Contribution Guide](./Contribution.md)

Note
----

[](#note)

If you need structured monetary representation with `Money` and `Currency` classes, following Martin Fowler's Money pattern, or native multi-currency support, consider using `Brick\Money`.
However, be aware that even with advanced libraries, flawed system design will still lead to issues that no tool can fix.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance49

Moderate activity, may be stable

Popularity8

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

Unknown

Total

1

Last Release

370d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e7f93f7407d7c7fbe8a27d3c8aaf863066168fbb6e1e75b0b847511571a4236?d=identicon)[Usmanzahidcode](/maintainers/Usmanzahidcode)

---

Top Contributors

[![usmanx03](https://avatars.githubusercontent.com/u/112874031?v=4)](https://github.com/usmanx03 "usmanx03 (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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