Download the PHP package whallysson/money-precision without Composer
On this page you can find all versions of the php package whallysson/money-precision. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download whallysson/money-precision
More information about whallysson/money-precision
Files in whallysson/money-precision
Package money-precision
Short Description A simple library for precise monetary value handling and financial calculations
License MIT
Informations about the package money-precision
MoneyPrecision
MoneyPrecision is a PHP library for precise monetary values, explicit minor-unit conversion, currency-aware arithmetic, and locale-safe formatting.
Requirements
- PHP
>=8.4 ext-bcmath
Installation
Core Rules
- Use explicit constructors:
fromMinorUnits(),fromCents(),fromDecimal(), andparse(). - Do not pass floats for monetary values.
- Values are stored internally as integer minor units.
- Prefer
fromMinorUnits()when code is currency-agnostic;fromCents()is a convenience alias for cent-based currencies. - Money objects are immutable: arithmetic returns a new instance.
- Each value carries a currency, and arithmetic between different currencies throws.
- Multiplication and division require an explicit
RoundingMode. parse()validates localized grouping strictly. UseparseLenient()only for trusted legacy input.- Parsing and formatting are separate from calculation.
Usage
Explicit Conversion
Parsing Formatted Values
Arithmetic
Multiplication And Division
Comparisons
Currency Formatting
Contributing
Please see CONTRIBUTING for details.
Support
Security: If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Se você descobrir algum problema relacionado à segurança, envie um e-mail para [email protected] em vez de usar o rastreador de problemas.
Credits
- Whallysson Avelino (Developer)
- Whallysson (Team)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of money-precision with dependencies
ext-bcmath Version *