Download the PHP package clippings/money-bundle without Composer

On this page you can find all versions of the php package clippings/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

TbbcMoneyBundle

Build Status [PHP]() [Symfony]() [Downloads]() [license]()

SensioLabsInsight

This bundle is used to integrate the Money library from mathiasverraes into a Symfony project.

This library is based on Fowler's Money pattern

Quick Start

Features

Table of contents

Installation

Use Composer and install with $ composer require tbbc/money-bundle

Then add the bundle in AppKernel :

In your config.yml, add the currencies you want to use and the reference currency.

In your config.yml, add the form fields presentations

You should also register custom Doctrine Money type:

Usage

Money Library integration

Form integration

You have 3 new form types (under Tbbc\MoneyBundle\Form\Type namespace):

Example :

Saving Money with Doctrine

Solution 1 : two fields in the database

Note that there are 2 columns in the DB table : $priceAmount and $priceCurrency and only one getter/setter : getPrice and setPrice.

The get/setPrice methods are dealing with these two columns transparently.

Solution 2 : use Doctrine type

There is only one string column in your DB table. The money object is manually serialized by the new Doctrine type.

1.25€ is serialized in your DB by 'EUR 125'. This format is stable. It won't change in future releases..

The new Doctrine type name is "money".

Conversion manager

Convert an amount into another currency

Save a conversion value in a DB

Money formatter

Twig integration

PHP templating integration

Fetching ratio values from remote provider

Change the ratio provider

This bundle uses florianv/swap library for requesting currency exchange rates from various providers.

The ratio provider is using yahoo finance provider. You can change the provider to use in the config.yml file:

Here google_provider is the name of the service which you need to define with Dependency Injection before using, e.g. like so:

You can use any providers as described at florianv/swap project, or even combination of those. The following example will try to use Yahoo provider and if it fails will switch to Google Provider instead:

Create your own ratio provider

A ratio provider is a service that implements the Swap\ProviderInterface. I recommend that you read the PHP doc of the interface to understand how to implement a new ratio provider.

The new ratio provider has to be registered as a service.

To use the new ratio provider, you should set the service to use in the config.yml by giving the service name.

Automatic currency ratio fetch

Add to your crontab :

MoneyManager : create a money object from a float

Create a money object from a float can be a bit tricky because of rounding issues.

history of currency ratio with the pairHistoryManager

Doctrine is required to use this feature.

In order to get the ratio history, you have to enable it in the configuration and to use Doctrine.

Then you can use the service :

RatioStorage

Two storages for storing ratios are available : CSV File, or Doctrine By default, TbbcMoneyBundle is configured with CSV File.

If you want to switch to a Doctrine storage, edit your config.yml

Update your database schema :

With the Doctrine storage, currency ratio will use the default entity manager and will store data inside the tbbc_money_doctrine_storage_ratios

Custom NumberFormatter in MoneyFormatter

The MoneyFormatter::localizedFormatMoney ( service 'tbbc_money.formatter.money_formatter' ) use the php NumberFormatter class ( http://www.php.net/manual/en/numberformatter.formatcurrency.php ) to format money.

You can :

Using the TbbcMoneyBundle without Doctrine

You have to disable the pair history service in order to use the TbbcMoneyBundle without Doctrine.

Note : you can imagine to code your own PairHistoryManager for MongoDB or Propel, it is very easy to do. Don't hesitate to submit a PR with your code and your tests.

Optimizations

In your config.yml, you can :

Note about older versions

Contributing

  1. Take a look at the list of issues.
  2. Fork
  3. Write a test (for either new feature or bug)
  4. Make a PR

Requirements

Authors

Philippe Le Van - kitpages.fr - twitter : @plv Thomas Tourlourat - Wozbe - twitter: @armetiz

Status

Stable

what is functional:


All versions of money-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
ext-curl Version *
symfony/framework-bundle Version ~2.8|~3.0
moneyphp/money Version ^3.0
symfony/form Version ~2.8|~3.0
symfony/twig-bundle Version ~2.8|~3.0
symfony/console Version ~2.8|~3.0
symfony/dom-crawler Version ~2.8|~3.0
florianv/swap Version ^3.2
php-http/message Version ^1.6
php-http/guzzle6-adapter Version ^1.1
composer/installers Version ^1.5
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 clippings/money-bundle contains the following files

Loading the files please wait ....