2017 © Pedro Peláez
 

library money-formatter

A money formatting package.

image

nwidart/money-formatter

A money formatting package.

  • Thursday, March 26, 2015
  • by nWidart
  • Repository
  • 1 Watchers
  • 6 Stars
  • 209 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

MoneyFormatter

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

A simple package used for formatting a Money\Money value object., (*2)

Money is usually not stored as a float in your database, though your clients/users don't want to see 1000 meaning, 10. This package receives an amount in cents, and displays it according to the given locale with or with the currency symbol., (*3)

Want to use this inside a Laravel application? Check out the MoneyFormatter-Laravel package., (*4)

Install

Via Composer, (*5)

``` bash $ composer require nwidart/money-formatter, (*6)


## Usage To format money in **cents**: ``` php $formatter = new MoneyFormatter('en_US'); $formattedMoney = $formatter->format(new Money(1000, new Currency('USD'))); # output : $10.00

Sometimes you may wish to not have the currency symbol, this can be done like so:, (*7)

``` php $formatter = new MoneyFormatter('en_US'); $formattedMoney = $formatter->formatWithoutCurrency(new Money(1000, new Currency('USD')));, (*8)

output : 10.00


This can be useful if your currency selection is a separate dropdown, for instance. ## Testing ``` bash $ phpunit

Contributing

Please see CONTRIBUTING for details., (*9)

Credits

License

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

The Versions

26/03 2015

dev-master

9999999-dev https://github.com/nWidart/MoneyFormatter

A money formatting package.

  Sources   Download

MIT

The Requires

 

The Development Requires

formatter money value object moneyformatter

24/03 2015

1.0

1.0.0.0 https://github.com/nWidart/MoneyFormatter

A money formatting package.

  Sources   Download

MIT

The Requires

 

The Development Requires

formatter money value object moneyformatter