PHP code example of sibyx / ecb-reference-rates-parser

1. Go to this page and download the library: Download sibyx/ecb-reference-rates-parser 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/ */

    

sibyx / ecb-reference-rates-parser example snippets




use EcbReferenceRates\EcbReferenceRatesParser;

t */
$list = EcbReferenceRatesParser::parse();

printf("Data from %s\n", $list->getDate()->format("Y-m-d"));
printf("JSON representation of RateReference object: %s\n", json_encode($list));

printf("\n");

/** @var \EcbReferenceRates\Models\Rate $rate */
foreach ($list->getRates() as $rate)
{
	printf("Currency: %s\n", $rate->getCurrency());
	printf("Rate: %f\n", $rate->getRate());
	printf("String representation of Rate object: %s\n", $rate);
	printf("JSON: %s\n", json_encode($rate));

	printf("\n");
}