README.md 1.3 KB
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

Thorsten Buss's avatar
Thorsten Buss committed
6
7
8
9
This is a fork of [Mathias Verraes' Money Library][4], extended with:
* add CurrencyLookup, for different currency sources (example for json-file included)
* extended List of currencies with settings (decimal_mark, subunit_factor, symbols, iso_code etc) from great [RubyMoney][5] (ISO 4217)
* add format method for formating the Money-string
Mathias Verraes's avatar
Mathias Verraes committed
10

Mathias Verraes's avatar
readme    
Mathias Verraes committed
11

12
13
14
15
16
17
18
19
20
21
22
23
24
```php
<?php

use Money\Money;

$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
readme    
Mathias Verraes committed
25

Thorsten Buss's avatar
Thorsten Buss committed
26
The documentation (before the fork) is available at http://money.readthedocs.org
Mathias Verraes's avatar
Mathias Verraes committed
27

28
29
30
31
32
33
34
35

Installation
------------

Install the library using [composer][1]. Add the following to your `composer.json`:

```json
{
36
    "require": {
Thorsten Buss's avatar
Thorsten Buss committed
37
38
        "bnnet/bnmoney": "~1.0"
    }
39
40
41
42
43
44
45
46
47
}
```

Now run the `install` command.

```sh
$ composer.phar install
```

48
49
50
Integration
-----------

Thorsten Buss's avatar
Thorsten Buss committed
51
See [`MoneyBundle`][2] for [Symfony integration][3] (only before the fork).
52
53
54
55

[1]: http://getcomposer.org/
[2]: https://github.com/pink-tie/MoneyBundle/
[3]: http://symfony.com/
Thorsten Buss's avatar
Thorsten Buss committed
56
57
[4]: https://github.com/mathiasverraes/money
[5]: https://github.com/RubyMoney/money