2017 © Pedro Peláez
 

library money

A class for dealing with Money (a combination of a value and a currency)

image

votemike/money

A class for dealing with Money (a combination of a value and a currency)

  • Tuesday, December 5, 2017
  • by votemike
  • Repository
  • 1 Watchers
  • 3 Stars
  • 965 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 7 Versions
  • 53 % Grown

The README.md

Money

Build Status Latest Stable Version Total Downloads Latest Unstable Version License composer.lock StyleCI, (*1)

Pass in an amount and currency to the Money object to create an immutable object. Perform actions with the object. Deals with different units/rounding of different currencies. Formats money for display Please use GitHub to raise any issues and suggest any improvements., (*2)

Install

Via Composer, (*3)

``` bash $ composer require votemike/money, (*4)


## Usage

$money = new Money(99.999999, 'GBP'); $add = $money->add(new Money(20, 'GBP')); $sub = $money->sub(new Money(20, 'GBP')); $multiply = $money->multiply(3); $divide = $money->divide(3); $abs = $money->abs(); $inv = $money->inv(); $percentage = $money->percentage(20); $round = $money->round(); list($first, $second, $third) = $money->split(20, 33.33);, (*5)

$money = new Money(99.50, 'JPY'); $money->format(); //¥100 $money->formatWithSign(); //+¥100 $money->getAmount(); //99.50 $money->getCurrency(); //JPY $money->getRoundedAmount(); //100, (*6)

$money = new Money(9500, 'USD'); $money->formatShorthand(); //$10k, (*7)

$money = new Money(-9.500, 'USD'); $money->formatForAccounting(); //(9.50) ```, (*8)

Credits

License

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

The Versions

05/12 2017

dev-master

9999999-dev

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

currency money

30/11 2017

dev-phpstan

dev-phpstan

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

currency money

30/11 2017

1.2.0

1.2.0.0

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

currency money

27/08 2017

1.1.1

1.1.1.0

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

currency money

22/08 2017

1.1.0

1.1.0.0

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

money

17/06 2016

1.0.1

1.0.1.0

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

money

10/06 2016

1.0.0

1.0.0.0

A class for dealing with Money (a combination of a value and a currency)

  Sources   Download

MIT

The Requires

 

The Development Requires

money