github akaunting/laravel-money 6.1.0

55 minutes ago

Added

Changed

  • IRR subunit is now 1 instead of 100 (#123, @ariaieboy)
  • Only Closure instances are called as callable amounts. Other callables, such as function-name strings or [Class, 'method'] arrays, now throw UnexpectedAmountException
  • convert() no longer changes the original object when the instance is immutable. It returns a new instance instead
  • allocate() throws InvalidArgumentException when the ratios are empty or sum to zero

Fixed

  • allocate() now distributes float amounts correctly, so the shares always add up to the original amount
  • The currency_code validation rule returns false for non-string input instead of throwing a TypeError
  • Tiny negative amounts that round to zero are no longer formatted as negative zero (-$0.00)
  • Calling a currency factory without an amount (Money::USD()) throws a clear UnexpectedAmountException
  • The bundled currency config is loaded only once
  • Mixin example in README (#119, @netzknecht)

Upgrade notes

  • IRR: if you store IRR amounts in subunits (that is, you create Money without convert: true), the same stored value is now read 100 times larger. For example, Money::IRR(1500) used to show ﷼15 and now shows ﷼1,500. Amounts created with convert: true are not affected.
  • If you pass amounts as callable strings or arrays, wrap them in a closure: fn () => ....

Don't miss a new laravel-money release

NewReleases is sending notifications on new releases.