Download the PHP package money/money without Composer
On this page you can find all versions of the php package money/money. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package money
Short Description PHP implementation of Fowler's Money pattern
License MIT
Homepage http://verraes.net/2011/04/fowler-money-pattern-in-php/
Informations about the package money
Money
Fork from Mathias Verraes implementation of Fowley's money pattern.
The current version of the fork divverges from Fowley's pattern by using floats as parameters on the Money constructor. This was introduced in order to cater to the issue of large monetary entities overflowing PHP int size on 32 bits platforms. This will be dealt with on later releases of this fork, so expect API breakage on minor releases.
PHP 5.3+ library to make working with money safer, easier, and fun!
"If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have $999.997634" -- Bill Karwin
In short: You shouldn't represent monetary values by a float. Wherever you need to represent money, use this Money value object.
The documentation is available at http://money.readthedocs.org
Installation
Install the library using composer. Add the following to your composer.json
:
Now run the install
command.
Added Features
This fork replaces the maping of currencies from a simple ISO 4217 map from openexchangerates.org with the data contained in Ruby's Money mapping. This allows for a few additional features, including generating formatted output string for the Money objects. Also, the Money object constructor takes a float parameter, using it as the amount instead of units. This will be changed on later releases.
Output:
Integration
See MoneyBundle
or TbbcMoneyBundle
for Symfony integration.