Integrate Swap for currency conversion
masterYou can use the Swap library to provide real-time exchange rates. First, install it via Composer:
$ composer require florianv/swapThen, use Money\Exchange\SwapExchange to wrap the Swap\SwapInterface implementation.
use Money\Money;
use Money\Converter;
use Money\Currencies\ISOCurrencies;
use Money\Exchange\SwapExchange;
// $swap = Implementation of \Swap\SwapInterface
$exchange = new SwapExchange($swap);
$converter = new Converter(new ISOCurrencies(), $exchange);
$eur100 = Money::EUR(100);
$usd125 = $converter->convert($eur100, new Currency('USD'));
[$usd125, $pair] = $converter->convertAndReturnWithCurrencyPair($eur100, new Currency('USD'));