PHP code example of stereoflo / cbr-currency
1. Go to this page and download the library: Download stereoflo/cbr-currency 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/ */
stereoflo / cbr-currency example snippets
tereoflo\CbrCurrency\DailyCurrencies;
use Stereoflo\CbrCurrency\HttpClient\SymfonyHttpClient;
use Stereoflo\CbrCurrency\Parser\XmlParser;
$rate = new DailyCurrencies(new SymfonyHttpClient(), new XmlParser());
$rate->withDate((new DateTime())->modify('-1 year'));
$isOk = $rate->retrieve();
$item = $rate->get('usd');
print $item->getDate()->format('d.m.Y');