GithubHelp home page GithubHelp logo

aslamsayyed / money Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moneyphp/money

0.0 1.0 0.0 218 KB

PHP implementation of Fowler's Money pattern. NOTE: all work is happening in the "nextrelease" branch, which will break BC.

Home Page: http://blog.verraes.net/2011/04/fowler-money-pattern-in-php/

License: MIT License

Makefile 11.51% Python 18.55% Shell 10.55% PHP 59.39%

money's Introduction

Money

Build Status

PHP 5.3+ library to make working with money safer, easier, and fun!

"If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have $999.997634" -- Bill Karwin

In short: You shouldn't represent monetary values by a float. Wherever you need to represent money, use this Money value object.

<?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)));

The documentation is available at http://money.readthedocs.org

Installation

Install the library using composer. Add the following to your composer.json:

{
    "require": {
        "mathiasverraes/money": "dev-master"
    },
    "minimum-stability": "dev"    
}

Now run the install command.

$ composer.phar install

Integration

See MoneyBundle or TbbcMoneyBundle for Symfony integration or DoctrineMoneyModule for Zend Framework 2.

money's People

Contributors

mathiasverraes avatar marijn avatar isabellejaffrezic avatar josecelano avatar pamil avatar asm89 avatar camspiers avatar fabiocarneiro avatar h4cc avatar

Watchers

James Cloos 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.