progjp/nbu-currency-api

从NBU API获取货币汇率

v1.0 2020-11-28 20:13 UTC

This package is auto-updated.

Last update: 2024-09-29 05:56:06 UTC


README

Latest Stable Version Total Downloads License composer.lock available

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());