xigen.io/currency-converter-bundle

There is no license information available for the latest version (v2.0.1) of this package.

Currency Converter bundle for Symfony

v2.0.1 2019-01-26 14:46 UTC

This package is auto-updated.

Last update: 2024-04-27 02:50:04 UTC


README

Currency Converter bundle for Symfony

Provides an easy way to convert an amount of GBP to common currencies within a Symfony project using the fixer.io API. Rates are stored in the symfony cache for a maximum of 4 hours before being updated automaticly.

Installation

composer require xigen.io/currency-converter-bundle

Finally register the bundle in app/AppKernel.php (if using Symfony 3):

$bundles = [
    [...]
    new Xigen\Bundle\CurrencyConverterBundle\CurrencyConverterBundle(),
];

Usage

// Fetch the convert service
$convert = $this->getContainer()->get('currency_converter.convert');

// Convert 10 euros into pounds
$pounds = $convert->from('EUR', 10);

// Convert 10 pounds into euros
$euros = $convert->to('EUR', 10);

dump([
    'pounds' => $pounds,
    'euros' => $euros,
]);