PHP code example of ipaulk / exchange-rates

1. Go to this page and download the library: Download ipaulk/exchange-rates 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/ */

    

ipaulk / exchange-rates example snippets


use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates;

$exchangeRates = new ExchangeRates();

/** @var float $value */
$value = $exchangeRates->getRate('USD', 'EUR');

use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates;

$exchangeRates = new ExchangeRates();
$exchangeRates->setProvider('fixerio');

/** @var float $value */
$value = $exchangeRates->getRate('USD', 'EUR');

use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates;

$exchangeRates = new ExchangeRates();

/** @var array $data */
$data = $exchangeRates->fetchRates('USD', ['EUR', 'GBP', 'JPY', 'RUB', 'ILS', 'AUD']);