moontoast/math
PHP math utilities for Laravel and general use, offering convenient helpers for precise calculations, percentages, rounding, and numeric formatting. Lightweight and easy to integrate into apps where consistent arithmetic and number handling matter.
Strengths:
Weaknesses:
float) suffices (e.g., most web apps, analytics).Key Synergies:
Dependencies:
Laravel-Specific Considerations:
AppServiceProvider.Math::bigInt()->add()) for cleaner syntax.BigInteger column type).Testing:
GMP extension for critical paths (may require hybrid approach).Math::add() without bounds checking).GMP/BCMath or a modern alternative (e.g., php-gmp).BCMath/GMP suffice (better performance, native PHP)?GMP extension necessary?GMP later)?Math::class => \Moontoast\Math\BigInteger::class).MathFacade for fluent syntax (e.g., Math::sqrt(2)).big_add(), big_divide()) in composer.json autoload.BigInteger type via Laravel Casts or Doctrine DBAL.json type in MySQL).JsonSerializable or custom filters.BigInteger|string) in Laravel’s validator.GMP/BCMath for key workflows.MathService) to allow future swaps (e.g., to GMP).GMP/BCMath.Math::isSafeForDatabase($value)).casts with strict validation.Math vs. native PHP types.NaN, infinity).How can I help you explore Laravel packages today?