Skip to content

0.15.0

Choose a tag to compare

@BenMorel BenMorel released this 09 Sep 19:52
· 10 commits to main since this release

💥 Breaking changes

  • The constructors of these exception classes are now @internal:
    • ExchangeRateProviderException
    • MoneyFormatException
  • MoneyNumberFormatter has been removed; call NumberFormatter::formatCurrency() directly instead
  • Money::formatToLocale() and MoneyLocaleFormatter:
    • now format through ICU's modern number skeleton pipeline, and minor formatting differences may appear in some locales
    • now require the intl extension to be linked against ICU 62.1 or later, and throw a MoneyFormatException on older ICU (this is independent of the PHP version)
    • now accept a CurrencyDisplay parameter in the second position
    • now throw a MoneyFormatException if the amount cannot be accurately represented as a float, rather than formatting it with wrong digits
    • now throw a MoneyFormatException if the intl extension has no data for the locale's language (e.g. xx_YY), rather than silently formatting in the process default locale
  • The $allowWholeNumber parameter of Money::formatToLocale() and MoneyLocaleFormatter has been renamed to $hideFractionIfWhole

✨ New features

  • Money::formatToLocale() and MoneyLocaleFormatter now accept a CurrencyDisplay parameter controlling how the currency is displayed: Symbol (default), NarrowSymbol, Code, Name, or None (amount only)
  • MoneyLocaleFormatter now properly displays custom currencies whose code is not three letters (e.g. USDT, GOLD)