PHP code example of allratestoday / sdk
1. Go to this page and download the library: Download allratestoday/sdk 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/ */
allratestoday / sdk example snippets
use AllRatesToday\AllRatesToday;
$client = new AllRatesToday();
$rate = $client->getRate('USD', 'EUR');
echo "1 USD = {$rate['rate']} EUR";
// Convert amount
$result = $client->convert('USD', 'EUR', 100);
echo "$100 = €{$result['result']}";
// With API key for higher limits & historical data
$auth = new AllRatesToday('art_live_...');
$history = $auth->getHistoricalRates('USD', 'EUR', '30d');