PHP & Laravel

Fluent BCMath

Readable arbitrary-precision math for PHP.

An immutable fluent interface around PHP BCMath operations and comparisons.

Status
Stable
Primary stack
PHP
License
MIT
Latest release
v1.0.1
Released
April 10, 2023
GitHub stars
2
PHP
fnum('1.23', 2)
  ->add(2)
  ->mul(4)
  ->sqrt();

Why it exists

Made for the work, not the demo.

Fluent BCMath wraps the extension’s string-oriented functions in a small value object that can be composed naturally. Numbers retain an explicit scale, operations return new instances, and comparisons read like intent rather than low-level function calls.

A helper function keeps common expressions concise, while conditional operation variants make it possible to preserve fluent chains without branching away from them.

Install with Composerterminal
composer require illegal/fluent-bcmath