Skip to content

Reference

phil/money

Every type of the library, with its role.

TypeKindRole
Phil\Money\Currencyfinal class, readonly code, Stringable, one instance per codeAn ISO 4217 code known to the CLDR data; precision, name and symbol
Phil\Money\Moneyfinal readonly classInteger minor units with a currency; arithmetic, comparison, decimals, allocation
Phil\Money\SchemaOrgfinal classamount(Money), price(Money): schema.org MonetaryAmount and Offer price
Phil\Money\Exception\MoneyExceptioninterface, extends ThrowableEvery exception of the library
Phil\Money\Exception\UnknownCurrencyfinal class, InvalidArgumentExceptionA code the CLDR data does not know
Phil\Money\Exception\InvalidAmountfinal class, InvalidArgumentExceptionA decimal, an amount or an allocation refused
Phil\Money\Exception\CurrencyMismatchfinal class, DomainExceptionTwo currencies met in one operation

See currencies.md, amounts.md, allocation.md and exceptions.md.

schema.org

SchemaOrg::amount(Money) gives a MonetaryAmount, and SchemaOrg::price(Money) gives the price and priceCurrency of an Offer. The value is the exact decimal as text, since a float would round it. The array has a @type and no @context: it is meant to be embedded in a larger JSON-LD document.