fruitcake/php-decimal

Decimal class for PHP

Maintainers

👁 barryvdh

Package info

github.com/fruitcake/php-decimal

pkg:composer/fruitcake/php-decimal

Fund package maintenance!

barryvdh

fruitcake.nl

Statistics

Installs: 2 486

Dependents: 0

Suggesters: 0

Stars: 16

Open Issues: 1

v2.0.0 2026-02-02 09:52 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT b81472256eeebbe5dd1427dab63b7b7afc566ee6

moneydecimalmath


README

👁 Unit Tests
👁 PHPStan Level 5
👁 Code Coverage
👁 Packagist License
👁 Latest Stable Version
👁 Total Downloads
👁 Fruitcake

Library for handling decimals in PHP

Installation

Require fruitcake/php-decimal using composer.

Example: using the library

<?php

use Fruitcake\Decimal\Decimal;

$decimal = new Decimal('1');
$value = $decimal->sub('0.8');

echo $decimal->toString(2); // "0.20"

License

Released under the MIT License, see LICENSE.