PHP code example of aveiv / open-exchange-rates-api
1. Go to this page and download the library: Download aveiv/open-exchange-rates-api 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/ */
aveiv / open-exchange-rates-api example snippets
$api = new OpenExchangeRates('YOUR_APP_ID');
// or $client = new OpenExchangeRates('YOUR_APP_ID', new YourHttpClient());
// Getting currencies
$api->currencies(); // returns ["USD" => "United States Dollar", ...]
$api->currencies([
'show_alternative' => true, // specific currencies
'show_alternative' => true, // ative currencies
]);
// Currency conversion
$api->convert(99.99, 'USD', 'EUR'); // returns the converted value (from USD to EUR)