Brick/Money is a money and currency library for PHP that handles exact calculations on monies of any size. So we can use this library that is based on brick/math and handles exact calculations on monies of any size. This library is installable via Composer: composer require brick/money

To create Money, call the of() factory method: use Brick\Money\Money; $money = Money::of(50, 'USD'); // USD 50.00 $money = Money::of('19.9', 'USD'); // USD 19.90 Alternatively, you can create Money from a number of "minor units"(cents), using the ofMinor() method: use Brick\Money\Money; $money = Money::ofMinor(1234, 'USD'); // USD 12.34
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners