Download the PHP package matmar10/money-bundle without Composer

On this page you can find all versions of the php package matmar10/money-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package money-bundle

Money Bundle

MAINTAINER WANTER - issue reports and pull requests will not be actively investigated. I am happy to advise, but I'm not longer actively using/maintaing this library. Please let me know if you're interested in taking over ownership of the repo.

Overview

Symfony2 Bundle wrapping common Money and Currency related needs such as integer-based math, currency codes, and money conversion.

Installation

Add the package to your composer.json file:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/matmar10/money-bundle
        }
    ],
    "require": {
        "matmar10/money-bundle": "dev-master"
    }
}

Creating Objects

Currencies are identified by a currency code and have a calculation and display precision:

Basic Math

The Money object wraps all basic math functions using underlying integer math to avoid the (problems with floating point math)[http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency].

All amounts are stored as integer values internally using the calculation precision as the scale.

Dealing with Fractional Cents

How do you divide $10 evenly amongst three people? In reality, you can't divide fractional cents.

Really, you want to end up with three equal-ish shares:

Converting Between Currencies

Use the CurrencyPair object to convert between disparate currencies using an exchange rate:

Note that the rate works bi-directionally:

Currency Manager Service

Instead of building up currencies and money objects manually all the time, consider using the lmh_money.currency_manager service that is registered into Symfony's dependency injection container.

The manager supports providing an ISO country or currency code:

Adding New Currencies

You can add new currencies that are not supported by default. This is useful, for example to add alternative currencies such as Litecoin and Ripple

Currency Alias

Alias handling for currencies, to set the currency settings "Euro" equel to "EUR", extend the config like this:

Currency Validator

The Bundle also includes a Symfony validator for use in validating an entity's attribute is a valid currency code using (Symfony's Validator component)[https://github.com/symfony/Validator].

Example use of the annotation:

Using in the validator (see (Validator Component docs for details)[https://github.com/symfony/Validator] ):

Embedded Money object in a Doctrine Entity

Money object is prepared to handle doctrine embedded style: http://doctrine-orm.readthedocs.org/en/latest/tutorials/embeddables.html

Add this to your config:

Inside your entity:

your table should now these two new columns:


All versions of money-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/symfony Version 2.4.*
symfony/framework-bundle Version 2.4.*
doctrine/orm Version *
jms/serializer Version ~0.15
jms/aop-bundle Version ~1.0
matmar10/lib-money Version ~1.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package matmar10/money-bundle contains the following files

Loading the files please wait ....