PHP code example of korkoshko / bestchange-api

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

    

korkoshko / bestchange-api example snippets

 
$bestChange = new BestChange();
$bestChange->setArchivePath(__DIR__); // If param is not set, a tmp directory is used 

$bestChange->download(); // Downloading archive with data

foreach($bestChange->getInfo() as $info) { // The generator returns (https://www.php.net/manual/ru/language.generators.php)
    var_dump($info);
}

// Or using sugar method

var_dump(
    $bestChange->getArray(InfoMethod::class);
);

foreach ($bestChange->getExchangers() as $exchanger) {
    var_dump($exchanger);
}