Laravel: MoneyPHP Wrapper and Helper
I’ve created a simple MoneyPHP wrapper to simplify my day to day work dealing with MoneyPHP.
and a currency configuration – where you can specify the label
for display use, and swift_code
for MoneyPHP usage:
And I’ve create a helper in my app/Support/helpers.php
, to simplify the usage of the MoneyPHP Wrapper.
A simple usage as following:
money()->toHuman(10000)
– use it for display it to end user.
money()->toMachine(10000)
– use it for create the right format before use in database or calculation.
money()->toCommon(10000)
– use if for common display at the frontend.