PHP code example of dasauser / currency-scoop-client

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

    

dasauser / currency-scoop-client example snippets


use \Dasauser\CurrencyScoop\CurrencyCode;
use \Dasauser\CurrencyScoop\ClientBuilder;

$client = (new ClientBuilder())->buildClient('yourApiKey');

$currency = $client->historical(
    CurrencyCode::USD,
    new \DateTimeImmutable('2015-06-15'),
    [CurrencyCode::EUR, CurrencyCode::GBP]
);

echo $currency->getCode()->value; // USD

echo $currency->getRate(CurrencyCode::EUR); // 0.88835713
echo $currency->getRate(CurrencyCode::GBP); // 0.6426023
echo $currency->getRate(CurrencyCode::BRL); // 0