PHP code example of masmaleki / nbg-currency
1. Go to this page and download the library: Download masmaleki/nbg-currency 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/ */
masmaleki / nbg-currency example snippets
use Masmaleki\NbgCurrency\NbgCurrency;
$currencies = 'USD,EUR';
$result = NbgCurrency::rate($currencies);
foreach($result->GetCurrentRatesResult->CurrencyRate as $rate) {
echo " --------------------\n";
echo "Quantity: " . $rate->Quantity . "\n";
echo "Rate: " . floatval($rate->Rate) . "\n";
echo "Diff: " . floatval($rate->Diff) . "\n";
echo "Code: " . $rate->Code . "\n";
echo "Name: " . $rate->Name . "\n";
echo "Date: " . $rate->Date . "\n";
echo "ValidFrom: " . $rate->ValidFromDate . "\n";
}
NbgCurrency::isSupported('usd'); // true
NbgCurrency::isSupported('lol'); // false