PHP code example of ksaveras / lb-fx-rates

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

    

ksaveras / lb-fx-rates example snippets


use Ksaveras\LBFxRates\PsrClient;
use Symfony\Component\HttpClient\Psr18Client;

// Psr18Client implements all three ent,
);

$fxRates = $fxRatesClient->currentFxRates();

foreach ($fxRates as $fxRate) {
    echo sprintf(
        "%s: %.4f %s == %.4f %s\n",
        $fxRate->date()->format('Y-m-d'),
        $fxRate->currencyAmount()->amount(),
        $fxRate->currencyAmount()->currency()->value,
        $fxRate->targetCurrencyAmount()->amount(),
        $fxRate->targetCurrencyAmount()->currency()->value,
    );
}