PHP code example of abstractapi / php-exchange-rates
1. Go to this page and download the library: Download abstractapi/php-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/ */
abstractapi / php-exchange-rates example snippets
$api_key = "YYYYYY"; // Get your API Key from https://app.abstractapi.com/api/exchange-rates/documentation
Abstractapi\ExchangeRates\AbstractExchangeRates::configure($api_key);
// Get live exchange rates using Abstract's Exchange Rates API and PHP
$info = Abstractapi\ExchangeRates\AbstractExchangeRates::live('EUR');
var_dump($info);
// Get historical exchange rates using Abstract's Exchange Rates API and PHP
$info = Abstractapi\ExchangeRates\AbstractExchangeRates::historical('EUR', '2021-05-01');
var_dump($info);
// Convert currency using Abstract's Exchange Rates API and PHP
$info = Abstractapi\ExchangeRates\AbstractExchangeRates::convert('EUR', 'USD');
var_dump($info);
bash
composer
bash
php vendor/bin/phpunit