1. Go to this page and download the library: Download alxdorosenco/ecb-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/ */
alxdorosenco / ecb-rates example snippets
xDorosenco\EcbRates\CurrencyRates;
// Latest rate attributes initialization
$daily = CurrencyRates::daily();
// Exchange 20 EUR to USD
$daily->rate(20, 'EUR', 'USD');
// Exchange 20 EUR to USD - special option
$daily->euroTo(20, 'USD');
// Exchange 20 USD to JPY
$daily->rate(20, 'USD', 'JPY');
lxDorosenco\EcbRates\CurrencyRates;
$history = CurrencyRates::history(); // History rate attributes initialization
// Get array of the rate attributes to the 2021-02-10 date
$history->findByDate('2021-02-10');
// Exchange 20 EUR to USD from the rate attributes to the 2021-02-10 date
$history->findByDate('2021-02-10')->rate(20, 'EUR', 'USD');
// Exchange 20 EUR to USD from the rate attributes to the 2021-02-10 date - special option
$history->findByDate('2021-02-10')->euroTo(20, 'EUR', 'USD');
// Get array of the latest rate attributes
$history->findByDate();
// Exchange 20 EUR to USD from the latest rate attributes
$history->rate(20, 'EUR', 'USD');
// Exchange 20 EUR to USD from the latest rate attributes - special option
$history->rate(20, 'EUR', 'USD')->euroTo(20, 'EUR', 'USD');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.