So lately I’ve been using the excellent Money library by Mathis Verraes, and I found myself in the need of formatting those Money objects into human readable form, and taking care of the different locales my site is built on.
The main problem is to know how many decimal places you must show for each one of the available currencies, and trying to solve that I stumbled on the excellent as well iso4217 library. That library provides the knowledge about the currencies that Mathias’ library is missing.
So I took a few minutes to create this Money formatter helper library, that uses both libraries to get the job done. I hope it’s useful for somebody and feedback is always welcome.