thalidzhokov / exchange-rates-cbrf
PHP class for daily exchange rates of the Central Bank of Russia by ISO 4217 alphabetic and numeric codes, with the ruble and cross rates
Package info
github.com/thalidzhokov/exchange-rates-cbrf
pkg:composer/thalidzhokov/exchange-rates-cbrf
Requires
- php: ^5.4 || ^7.0 || ^8.0
- ext-simplexml: *
- ext-soap: *
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
- ext-openssl: Needed to load the CBR WSDL over HTTPS
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-24 23:13:44 UTC
README
Requirements
- PHP 5.4, 7 or 8
- SOAP and SimpleXML
- OpenSSL, to reach the bank over HTTPS. Without it the class falls back to HTTP.
Installation
Install via Composer
composer require thalidzhokov/exchange-rates-cbrf
OR include ExchangeRatesCBRF.php in your PHP code
require_once("ExchangeRatesCBRF.php");
Usage
Examples of using ExchangeRatesCBRF Class to get exchange rates of the Central Bank of Russia
Example 1
Get exchange rate of Ukrainian Hryvnia (Alphabetic currency code - UAH) on 25.05.2015
$rates = new ExchangeRatesCBRF("2015-05-25"); echo $rates->GetRate("UAH");
Example 2
Get cross-rate of the US Dollar to Euro on 26.06.2015
$rates = new ExchangeRatesCBRF("2015-06-26"); echo $rates->GetCrossRate("EUR", "USD");
Example 3
Get exchange rates of the Central Bank of Russia on 27.07.2015
$rates = new ExchangeRatesCBRF("2015-07-27"); echo $rates->GetRates();