xigen.io / currency-converter-bundle
Currency Converter bundle for Symfony
Installs: 853
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.2
- guzzlehttp/guzzle: ^6.3
- symfony/framework-bundle: ^3.4|^4
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, ]);