A money and currency library for PHP
π₯ Breaking changes
PDOProviderConfiguration
no longer has getters, its properties are public readonly
RoundingMode
from brick/math
is now an enum, so:
int
rounding mode now accept a RoundingMode
instance insteadRoundingMode::UP
π Improvement
Currency
now implements JsonSerializable
(#79).
Thanks @joelvh!
π₯ Breaking changes
HRK
currency (Kuna) has been removed from the ISO currency providerHR
country (Croatia) is now mapped to EUR
(Euro)PDOProviderConfiguration
now has a proper constructor, and its properties are no longer publicPDOProviderConfiguration
now throws exceptions in the constructor when configuration is invalidExchangeRateProvider
implementation, you will need to update your getExchangeRate()
method signatureStringable
objects to of()
or any of the methods internally calling of()
, and have strict_types
enabled, you will need to explicitly cast these objects to string
firstπ Improvements
brick/math
version 0.11
π₯ Breaking changes
AbstractMoney
is now officially sealed, extending it yourself is not supported⨠New features
Money
and RationalMoney
now implement JsonSerializable
π₯ Breaking changes
AbstractMoney::getAmount()
now has a return typeCurrencyConverter
's constructor does not accept a default $context
anymoreCurrencyConverter::convert()
now requires the $context
previously accepted by the constructor as third parameterMoney::allocateWithRemainder()
now refuses to allocate a portion of the amount that cannot be spread over all ratios, and instead adds that amount to the remainder (#55)Money::splitWithRemainder()
now behaves like allocateWithRemainder()
β¨ New ISO currencies
SLE
(Leone) in Sierra Leone (SL
)π Improvements
brick/math
version 0.10
β¨ Add support for VED
(Venezuelan bolΓvar) currency.
β¨ New methods
Money::splitWithRemainder()
Money::allocateWithRemainder()
These methods perform like their split()
and allocate()
counterparts, but append the remainder at the end of the returned array instead of spreading it over the first monies.
Thanks @NCatalani!
π Improvement
BaseCurrencyProvider
now always returns a BigNumber
for convenience (#37).
This is useful if you're using BaseCurrencyProvider
on its own, not just in CurrencyConverter
.
Thanks @rdarcy1!
π Improvements
brick/math
version 0.9
β οΈ Caution
When using brick/math
version 0.9
, the Money
factory methods such as of()
and ofMinor()
now accept decimal numbers in the form .123
and 123.
, and do not throw an exception anymore in this case.