falconur/currency-cbuuz

来自CBU UZ的货币汇率

v1.0.4 2023-04-26 10:13 UTC

This package is auto-updated.

Last update: 2024-09-26 12:59:28 UTC


README

通过此库,您可以通过中心银行的API获取货币汇率。

安装

composer require falconur/currency-cbuuz

使用

<?php 

$currency = new CurrencyRequest();

$currencies = $currency->getAllForToday();
# yoki
$currency = $currency->getByCurrencyAndDate(CurrencyType::AFGHANI, '04/02/2023');

您可以通过以下函数获取通知

  1. getAllForToday() - 获取今天的货币汇率;
  2. getAllByDate - 获取任意日期的所有货币汇率;
  3. getByCurrencyForToday - 获取相同货币今天的汇率;
  4. getByCurrencyAndDate - 获取相同货币任意日期的汇率。

结果

结果返回到 Currency 类中。

Currency 类属性

  1. id - (int) 排序编号;
  2. number - (string) 货币的数字代码。例如:840, 978, 643 等;
  3. code - (string) 货币的符号代码(3位字母)。例如:USD, EUR, RUB 等;
  4. name_uz - (string) 货币的乌兹别克(拉丁)名称;
  5. name_ru - (string) 货币的俄语名称;
  6. name_uzc - (string) 货币的乌兹别克(西里尔)名称;
  7. name_en - (string) 货币的英语名称;
  8. nominal - (int) 货币的单位数量;
  9. rate - (float) 货币汇率;
  10. diff - (float) 货币汇率差异;
  11. date - (string) 汇率的生效日期。

货币类型

货币类型存储在 CurrencyType 类中(枚举)。

<?php

$currency = $currency->getByCurrencyForToday(CurrencyType::QATARI_RIAL);