README.md 672 Bytes
Newer Older
Mathias Verraes's avatar
Mathias Verraes committed
1
Money
Mathias Verraes's avatar
Mathias Verraes committed
2
=====
Mathias Verraes's avatar
Mathias Verraes committed
3

Mathias Verraes's avatar
Mathias Verraes committed
4
PHP 5.3+ library to make working with money safer, easier, and fun!
Mathias Verraes's avatar
Mathias Verraes committed
5

Mathias Verraes's avatar
Mathias Verraes committed
6
In short: You probably shouldn't represent monetary values by a float. Wherever 
Mathias Verraes's avatar
readme    
Mathias Verraes committed
7
8
9
10
11
12
13
14
15
16
17
you need to represent money, use this Money value object.

    <?php
	$fiveEur = Money::EUR(500);
	$tenEur = $fiveEur->add($fiveEur);
	
	list($part1, $part2, $part3) = $tenEur->allocate(array(1, 1, 1));
	assert($part1->equals(Money::EUR(334)));
	assert($part2->equals(Money::EUR(333)));
	assert($part3->equals(Money::EUR(333)));

Mathias Verraes's avatar
link    
Mathias Verraes committed
18
The documentation is available at http://money.readthedocs.org
Mathias Verraes's avatar
Mathias Verraes committed
19

Mathias Verraes's avatar
Mathias Verraes committed
20
[![Build Status](https://secure.travis-ci.org/mathiasverraes/money.png)](http://travis-ci.org/mathiasverraes/money)