Download the PHP package reaway/boc-cny-quote without Composer
On this page you can find all versions of the php package reaway/boc-cny-quote. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download reaway/boc-cny-quote
More information about reaway/boc-cny-quote
Files in reaway/boc-cny-quote
Download reaway/boc-cny-quote
More information about reaway/boc-cny-quote
Files in reaway/boc-cny-quote
Vendor reaway
Package boc-cny-quote
Short Description Bank of China CNY quote
License Apache-2.0
Homepage https://github.com/reaway/boc-cny-quote
Package boc-cny-quote
Short Description Bank of China CNY quote
License Apache-2.0
Homepage https://github.com/reaway/boc-cny-quote
Please rate this library. Is it a good library?
Informations about the package boc-cny-quote
BocCnyQuote
一个用于获取中国银行人民币汇率数据的 PHP 库,支持多种数据源(桌面版网页、移动版网页、微信小程序、聚合数据 API)。
功能特性
- 支持多种数据源:
desktop- 中国银行桌面版网页(默认)mobile- 中国银行移动版网页we_chat_mini_program- 中国银行微信小程序接口juhe- 聚合数据 API(需要申请 API Key)
- 支持门面(Facade)模式调用
- 支持获取所有汇率或指定货币汇率
- 支持现汇买入价、现钞买入价、现汇卖出价、现钞卖出价、中行折算价
安装
环境要求
- PHP >= 8.1
- 扩展:bcmath、dom、mbstring
支持的货币
| 货币代码 | 货币名称 | 货币代码 | 货币名称 |
|---|---|---|---|
| AED | 阿联酋迪拉姆 | AUD | 澳大利亚元 |
| BND | 文莱元 | BRL | 巴西雷亚尔 |
| CAD | 加拿大元 | CHF | 瑞士法郎 |
| CZK | 捷克克朗 | DKK | 丹麦克朗 |
| EUR | 欧元 | GBP | 英镑 |
| HKD | 港币 | HUF | 匈牙利福林 |
| IDR | 印尼卢比 | ILS | 以色列谢克尔 |
| INR | 印度卢比 | JPY | 日元 |
| KHR | 柬埔寨瑞尔 | KRW | 韩国元 |
| KWD | 科威特第纳尔 | MNT | 蒙古图格里克 |
| MOP | 澳门元 | MXN | 墨西哥比索 |
| MYR | 林吉特 | NOK | 挪威克朗 |
| NPR | 尼泊尔卢比 | NZD | 新西兰元 |
| PHP | 菲律宾比索 | PKR | 巴基斯坦卢比 |
| QAR | 卡塔尔里亚尔 | RSD | 塞尔维亚第纳尔 |
| RUB | 卢布 | SAR | 沙特里亚尔 |
| SEK | 瑞典克朗 | SGD | 新加坡元 |
| THB | 泰国铢 | TRY | 土耳其里拉 |
| TWD | 新台币 | USD | 美元 |
| VND | 越南盾 | ZAR | 南非兰特 |
使用方法
基础用法
使用门面(Facade)
配置说明
| 配置项 | 类型 | 说明 |
|---|---|---|
| default | string | 默认数据源驱动,可选值:desktop、mobile、we_chat_mini_program、juhe |
| sources.juhe.key | string | 聚合数据 API 访问密钥(仅在 juhe 驱动时需要) |
数据源说明
desktop(桌面版网页)
- 数据源:中国银行官网桌面版
- 特点:数据完整,无需 API Key
- URL:https://www.boc.cn/sourcedb/whpj/
mobile(移动版网页)
- 数据源:中国银行官网移动版
- 特点:数据完整,无需 API Key
- URL:https://www.boc.cn/sourcedb/whpj/sjmfx_1621.html
we_chat_mini_program(微信小程序)
- 数据源:中国银行微信小程序接口
- 特点:数据实时,无需 API Key
juhe(聚合数据)
- 数据源:聚合数据 API
- 特点:需要申请 API Key
- URL:http://web.juhe.cn/finance/exchange/rmbquot
- 申请地址:https://www.juhe.cn/docs/api/id/23
返回数据格式
API 方法
CnyQuote 类
| 方法 | 说明 |
|---|---|
getQuotes(): array |
获取所有人民币汇率数据 |
getQuote(string $currency): array\|null |
获取指定货币的人民币汇率 |
source(string\|null $name): CnyQuoteAbstract |
获取指定驱动实例 |
getResponse(): string |
获取数据源响应内容(原始数据) |
getSourceUrl(): string |
获取数据源 URL |
许可证
Apache-2.0 License. 详情请查看 LICENSE 文件。
All versions of boc-cny-quote with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.1
ext-bcmath Version *
ext-dom Version *
ext-mbstring Version *
reaway/curl-client Version ^1.0
reaway/think-manager Version ^8.0
reaway/think-facade Version ^8.0
reaway/think-config Version ^8.0
ext-bcmath Version *
ext-dom Version *
ext-mbstring Version *
reaway/curl-client Version ^1.0
reaway/think-manager Version ^8.0
reaway/think-facade Version ^8.0
reaway/think-config Version ^8.0
The package reaway/boc-cny-quote contains the following files
Loading the files please wait ...