PHPackages                             fruitcake/php-decimal - 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. fruitcake/php-decimal

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

fruitcake/php-decimal
=====================

Decimal class for PHP

v2.0.0(4mo ago)162.4k1[1 PRs](https://github.com/fruitcake/php-decimal/pulls)MITPHPPHP ^8.2CI passing

Since Oct 23Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/fruitcake/php-decimal)[ Packagist](https://packagist.org/packages/fruitcake/php-decimal)[ Docs](https://github.com/fruitcake/php-decimal)[ Fund](https://fruitcake.nl)[ GitHub Sponsors](https://github.com/barryvdh)[ RSS](/packages/fruitcake-php-decimal/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (6)Versions (12)Used By (0)

Decimal class for PHP
=====================

[](#decimal-class-for-php)

[![Unit Tests](https://github.com/fruitcake/php-decimal/actions/workflows/run-tests.yml/badge.svg)](https://github.com/fruitcake/php-decimal/actions)[![PHPStan Level 5](https://camo.githubusercontent.com/b36a3f84ed1085ab26c867199cfdc78e522c436a9f9acad9eabeb0a2db108db1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230352d626c7565)](https://github.com/fruitcake/php-decimal/actions)[![Code Coverage](https://camo.githubusercontent.com/ce3be308ae17b5c72b6f5f6da39c1b2947df3ec630893608ce429eb2dd08928b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6465436f7665726167652d3130302532352d627269676874677265656e)](https://github.com/fruitcake/php-decimal/actions/workflows/run-coverage.yml)[![Packagist License](https://camo.githubusercontent.com/e1c8796d97bad613850bc218814833e7ba8d6dc560c96caf3f58853c8160670a/68747470733a2f2f706f7365722e707567782e6f72672f667275697463616b652f7068702d646563696d616c2f6c6963656e73652e706e67)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/7b9d0bb56b0ac82d39ce864bfcfd03429e7183b0440d80f9632729ccc7211cd4/68747470733a2f2f706f7365722e707567782e6f72672f667275697463616b652f7068702d646563696d616c2f76657273696f6e2e706e67)](https://packagist.org/packages/fruitcake/php-decimal)[![Total Downloads](https://camo.githubusercontent.com/1e98038aab64c855540df37a10b4dcf61924fd14148c537d93f111cb4418bcc9/68747470733a2f2f706f7365722e707567782e6f72672f667275697463616b652f7068702d646563696d616c2f642f746f74616c2e706e67)](https://packagist.org/packages/fruitcake/php-decimal)[![Fruitcake](https://camo.githubusercontent.com/28d7584b52e33d7b4ffb6b1bef8b89b6e598adb45c8c0d5f80349c1c304f385e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323042792d467275697463616b652d6232626333352e737667)](https://fruitcake.nl/)

Library for handling decimals in PHP

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

[](#installation)

Require `fruitcake/php-decimal` using composer.

### Example: using the library

[](#example-using-the-library)

```
