Download the PHP package ongr/currency-exchange-bundle without Composer
On this page you can find all versions of the php package ongr/currency-exchange-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ongr/currency-exchange-bundle
More information about ongr/currency-exchange-bundle
Files in ongr/currency-exchange-bundle
Package currency-exchange-bundle
Short Description ONGR currency exchange bundle
License MIT
Homepage http://ongr.io
Informations about the package currency-exchange-bundle
ONGR Currency Exchange Bundle
This bundle provides an easy way to display price in multiple currencies. It gives a solution to fetch and store current currency rates, to convert prices and display them in Twig templates.
Documentation
The documentation of the bundle can be found in Resources/doc/
Installation
Follow 5 quick steps to setup this bundle.
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Register bundles in app/AppKernel.php
:
Step 3: Update Elasticsearch Mapping
This bundle provides Elasticsearch document to store currency rates. Add this bundle to your ES manager's mapping to associate it:
Step 4: Configure the Bundle
Configure the currencies you need in config.yml
file.
That's it for setup, jump to the next chapter to learn how to use this bundle.
Usage
The main parts of this bundle are a command to update currency rates and Twig helpers to display price in various currencies.
Before converting prices you need to fetch the latest currency rates:
Tip: setup a cron job to update currencies daily in your production environment.
Now you are ready to use currency conversion logic in your templates. Here is a simple example how to convert currency:
In this example the number 2 represents the number of decimal points. It will print the following information:
To learn more read about provided Twig helpers or check example currency switching implementation.
License
This package is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
All versions of currency-exchange-bundle with dependencies
symfony/symfony Version ~2.7|~3.0
doctrine/cache Version ~1.4
ongr/elasticsearch-bundle Version ~1.0