Brick\Money v0.3.2 Release Notes

Release Date: 2018-08-20 // over 5 years ago
  • Money::formatTo() can now format the amount as a whole number:

    formatTo(string $locale, bool $allowWholeNumber = false) : string
    

    0️⃣ By default, formatTo() always outputs all the fraction digits:

    Money::of('23.5', 'USD')->formatTo('en_US'); // $23.50
    Money::of(23, 'USD')->formatTo('en_US'); // $23.00
    

    But can now be allowed to return the whole number by passing true as a second argument:

    Money::of('23.5', 'USD')->formatTo('en_US', true); // $23.50
    Money::of(23, 'USD')->formatTo('en_US', true); // $23
    

    Note that this version now requires brick/math version 0.7.3. This is not a BC break. If you've locked your composer.json to an earlier version, you will just not be able to install brick/money version 0.3.2.