georgii-web/cbr-api-exchange
Composer 安装命令:
composer require georgii-web/cbr-api-exchange
包简介
Cbr.ru exchange rate API package. Gets currency rate from Russian Central Bank API, http://www.cbr.ru.
README 文档
README
Cbr.ru exchange API.
Gets currency rate from Russian Central Bank API, http://www.cbr.ru.
All currencies list: http://www.cbr.ru/scripts/XML_val.asp?d=0
Get USD rate example url: http://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=01/01/2021&date_req2=12/01/2021&VAL_NM_RQ=R01235
Features
Centrak Bank announce exchange rate for tomorrow everyday (in a second part of the day).
On holidays there are no announcements, so it uses previous date of the exchange rate.
For example, on 2020-12-31 at 08:00 we don't get exchange rate for 2021-01-01, but at 21:00 we'll get it. And if we check exchange rate on 2021-01-04 we get it for 2021-01-01.
Install
$ composer require georgii-web/cbr-api-exchange
How to
Add class
use CbrApiExchange\CbrApiExchange;
Use examples
CbrApiExchange::get(); // Get default currency 'R01235'(USD) on default date 'Today()'
CbrApiExchange::get('R01239'); // Get currency 'R01239'(EUR) on default date 'Today()'
CbrApiExchange::get('R01239', '2021-01-01'); // Get currency 'R01239'(EUR) on date '2021-01-01'
Returns
[
"code" => "R01235", // The actual currency code
"date" => "2021-01-01", // The actual date of the exchange rate
"rate" => 73.8757, // Exchange rate of this currency to the Ruble
]
Development
Testing
$ ./vendor/bin/pest
Psalm check
$ ./vendor/bin/psalm
统计信息
- 总下载量: 414
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-16