fruitcake/php-decimal

Decimal class for PHP

Maintainers

Package info

github.com/fruitcake/php-decimal

pkg:composer/fruitcake/php-decimal

Fund package maintenance!

barryvdh

fruitcake.nl

Statistics

Installs: 2 273

Dependents: 0

Suggesters: 0

Stars: 16

Open Issues: 1

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

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.