progjp / nbu-currency-api
从NBU API获取货币汇率
v1.0
2020-11-28 20:13 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- phpstan/phpstan: ^0.11.8
- phpunit/phpunit: ^8.2
- symfony/var-dumper: ^4.3
README
NBU货币客户端
PHP客户端用于NBU(乌克兰国家银行)API服务(《https://old.bank.gov.ua/doccatalog/document?id=72819047`)
要求
- PHP >=7.2
- ext-json
- ext-curl
安装
通过Composer
$ composer require progjp/nbu_currency
使用方法
获取所有货币汇率
$client = new CurrencyApiClient(); $client->getCurrencyRate();
按日期获取所有货币汇率
$client = new CurrencyApiClient(); $client->getCurrencyRate(null, new DateTime());
按日期获取货币汇率
$client = new CurrencyApiClient(); $client->getCurrencyRate('USD', new DateTime());