A library for dealing with money and currency conversion. PHP port of http://money.rubyforge.org
<?php
require_once 'src/money.php';
// 10.00 USD
$money = new money\Money(1000, 'USD');
$money->cents(); // => 1000
$money->currency(); // => new money\Currency("USD")
This project is still a work in progress.
Things to do:
- money comparison
- money arithmetic
- currency conversion
Contributions welcome. :-)
Tests are located in the tests subdirectory.
You'll need to install PHPUnit before running the tests: http://www.phpunit.de/manual/3.5/en/installation.html
Then run the tests like this:
phpunit tests
All credit goes to the creators of the Ruby money library. This is a direct port of the code.