GithubHelp home page GithubHelp logo

moneyformatter's Introduction

Money Formatter

Build Status

Class to convert Mathias Verraes Money value objects to the base unit representation of the given currency (float) or to a string representation given a locale, using php's intl extension.

To do so it leverages the info provided by the iso4217 library from Alcohol in order to know the exact number of decimal places that each currency uses.

##Installation ###Composer This library is available in packagist.org, you can add it to your project via Composer.

In the "require" section of your composer.json file:

Always up to date (bleeding edge, API not guaranteed stable)

"antonienko/money-formatter": "dev-master"

Specific minor version, API stability

"antonienko/money-formatter": "1.0.*"

##Sample Usage

use antonienko\MoneyFormatter\MoneyFormatter;
use Money\Currency;
use Money\Money;

$money = new Money(300005, new Currency('EUR')

$mf = new MoneyFormatter();
$amount = $mf->getAmountInBaseUnits($money); //$amount will be (float)3000.05
$french_formatted = $mf->toStringByLocale('fr_FR', $money) //$french_formatted will be '3 000,05 €'

##License Information Lincensed under The MIT License (MIT). See the LICENSE file for more details.

moneyformatter's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.