PHP code example of xigen.io / currency-converter-bundle
1. Go to this page and download the library: Download xigen.io/currency-converter-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xigen.io / currency-converter-bundle example snippets
$bundles = [
[...]
new Xigen\Bundle\CurrencyConverterBundle\CurrencyConverterBundle(),
];
// 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,
]);