2017 © Pedro PelĂĄez
 

library moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

image

keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  • Tuesday, August 16, 2016
  • by keiosweb
  • Repository
  • 3 Watchers
  • 18 Stars
  • 11,327 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 9 Versions
  • 5 % Grown

The README.md

Keios/MoneyRight

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Arbitrary precision arithmetic-based Money value object. Drop-in replacement for Mathias Verraes' Money library (some use statement tweaking required). Follows GAAP suggestion to use 4 decimal places with rounding on 5th to minimize statistical influence of rounding errors., (*2)

Follows PSR-2 guidelines., (*3)

Project name is inspired by Kanye West's verse:, (*4)

La la la la... wait till I get my money right!

As we all know money really should be right (and therefore not stored in floats!)., (*5)

Requirements

PHP 5.4.0+ BCMath Arbitrary Precision Arithmetic PHP extension, (*6)

Install

Via Composer, (*7)

``` bash $ composer require keios/moneyright, (*8)


## Usage ``` php $tenEuroNetPrice = Keios\MoneyRight\Money::EUR('10'); // Money::EUR(10000) integers as cents | Money::EUR(10.0) floats as literal amount var_dump($tenEuroNetPrice->getAmount()); // int(1000) - cents var_dump($tenEuroNetPrice->getAmountString()); // string(7) "10.0000" - literal amount in string with 4 decimal points precision $vatTax = $tenEuroNetPrice->multiply('0.23'); // 23% VAT tax var_dump(assert(!$vatTax->equals($tenEuroNetPrice))); // bool(true) var_dump($vatTax->getAmountString()); // string(6) "2.3000" $grossPrice = $tenEuroNetPrice->add($vatTax); // instances are immutable, so every operation returns new instance var_dump($grossPrice->getAmountString()); // string(7) "12.3000" var_dump($grossPrice->getAmount()); // int(1230) - cents

Testing

bash $ phpunit, (*9)

Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

The MIT License (MIT). Please see License File for more information., (*11)

The Versions

16/08 2016

dev-master

9999999-dev https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

16/08 2016

v1.0.8

1.0.8.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

01/06 2016

v1.0.7

1.0.7.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

04/12 2015

v1.0.6

1.0.6.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

04/12 2015

dev-develop

dev-develop https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

23/09 2015

v1.0.5

1.0.5.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

20/02 2015

1.0.2

1.0.2.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

08/02 2015

v1.0.1

1.0.1.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

money moneyright gaap

08/02 2015

v1.0.0

1.0.0.0 https://github.com/keios/moneyright

Precise, GAAP-compliant, database-friendly Money Value Object

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

money moneyright gaap