PHP code example of naffiq / php-tenge-rates

1. Go to this page and download the library: Download naffiq/php-tenge-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/ */

    

naffiq / php-tenge-rates example snippets




ffiq\tenge\CurrencyRates;
$rates = new CurrencyRates();
echo $rates->convertToTenge('USD', 100); // 33214 на момент написания примера



affiq\tenge\CurrencyRatecs;
// URL для всех валют содержится в качестве константы в классе CurrencyRates
$rates = new CurrencyRates(CurrencyRates::URL_RATES_ALL);
echo $rates->convertToTenge('GBP', 100); // 41242 на момент написания примера



ffiq\tenge\CurrencyRates;
$rates = new CurrencyRates();

foreach ($rates as $rate) {
    /**
     * @var \naffiq\tenge\Currency $rate 
     */
    echo "{$rate->title} - {$rate->price}";
}



ffiq\tenge\CurrencyRates;
$rates = new CurrencyRates(CurrencyRates::URL_RATES_MAIN, 10); // $timeout == 10
bash
$ composer