antonvlasenko / decimal
An object-oriented wrapper around BC Math PHP extension
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/antonvlasenko/decimal
Requires
- php: >=7.2
- ext-bcmath: *
Requires (Dev)
- phpstan/phpstan: ^0.11.16
- phpstan/phpstan-phpunit: ^0.11.2
- phpunit/phpunit: ^8.3
- symplify/easy-coding-standard: ^6.1
This package is auto-updated.
Last update: 2025-10-05 22:01:59 UTC
README
Decimal
is an object-oriented wrapper around BC Math PHP extension.
It allows to use OOP when working when decimal numbers.
This package also adds support for exponent numbers.
Installation
composer require antonvlasenko/decimal
Running tests
composer run tests
Note: there are other useful commands available. Check composer.json
for more information.
Example
use AntonVlasenko\Decimal\Decimal; Decimal::$SCALE = 20; // Sets precision $decimal = new Decimal('5e2'); echo $decimal->divideBy(3); // 166.66666666666666666666