PHP code example of darkfriend / php-tenge-rates

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

    

darkfriend / php-tenge-rates example snippets




rkfriend\TengeRates\CurrencyRates;

$rates = new CurrencyRates();
echo $rates->convertToTenge('USD', 100);



rkfriend\TengeRates\CurrencyRates;

$rates = new CurrencyRates('23.08.2022');
echo $rates->convertFromTenge('GBP', 100);



rkfriend\TengeRates\CurrencyRates;

$rates = new CurrencyRates();

/** @var \Darkfriend\TengeRates\Currency $rate */
foreach ($rates as $rate) {
    echo "{$rate->name} - {$rate->price}";
}



rkfriend\TengeRates\CurrencyRates;
$rates = new CurrencyRates('23.08.2022', 15); // timeout 15 secs
bash
$ composer