Download the PHP package sirix/money without Composer
On this page you can find all versions of the php package sirix/money. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package money
Short Description Immutable, framework-agnostic currency catalogs and money factories
License MIT
Informations about the package money
Sirix Money
Flexible, framework-agnostic currency catalogs and money factories for Brick Money. It provides a small, explicit application boundary around Brick's precise monetary types: resolve currencies from immutable catalogs, create money in major or minor units, and format amounts without coupling the application to a framework or global registry.
Why Sirix Money
- Safe monetary input - accepts
BigNumber, integers, and decimal strings while rejecting floats before their binary precision can alter a value. - Application-owned currencies - use the built-in ISO and digital currencies, define a complete custom catalog, or compose both with clear duplicate detection.
- Explicit, predictable construction - create
MoneythroughMoneyFactorywith documented rounding behaviour and support for major and minor units. - Framework and worker friendly - immutable catalogs have no cache, container, or static global state, so they can be created once at bootstrap and shared safely.
Requires PHP 8.2 and brick/money.
Install
For a source checkout, install the package normally. Development tools are opt-in and require PHP 8.3+:
Quick start
MoneyFactory uses HALF_UP by default, except that AutoContext uses Brick's required UNNECESSARY rounding mode when no mode is supplied. Amounts must be BigNumber, int, or decimal string; floats are rejected even for applications that do not enable strict PHP types.
Build your own catalog
An ArrayCurrencyCatalog can be the complete currency universe for an application. Use numeric code 0 when a custom currency has no numeric identifier.
To add application currencies to the built-in ISO and digital seed, compose catalogs explicitly. Duplicate canonical string or non-zero numeric codes fail at bootstrap. String codes are not restricted to enum-shaped names.
Use CurrencyCatalogBuilder::replace() only during bootstrap when deliberately replacing an existing definition.
Major and minor units
of() accepts a major-unit decimal amount. ofMinor() accepts an integer amount in the currency's smallest unit. Use strings for values that may exceed PHP integer range.
Catalogs are immutable and safe to construct at a long-running worker's bootstrap.
Documentation
| Guide | Description |
|---|---|
| v2 design | Public contract and deliberate breaking changes |
| Dependency injection | Container and persistent-worker wiring |
| Built-in currencies | The source-controlled digital seed and ISO metadata source |
| Upgrading to v2 | Migration from the v1 API |
License
MIT. See LICENSE.