ihfazhillah/php-openexchangerates-wrapper
Composer 安装命令:
composer require ihfazhillah/php-openexchangerates-wrapper
包简介
a php wrapper of open exchange rates api
README 文档
README
php-openexchangerates-wrapper helps you to make a request to https://openexchangerates.org/api, converting accross currencies with or without api and cache your result into files.
Installation
composer require ihfazhillah/php-openexchangerates-wrapper
Getting Started
<?php
require_once("vendor/autoload.php");
use OpenExchangeRatesWrapper\OpenExchangeRates;
$oxr = new OpenExchangeRates("YOUR APP ID");
$latest = $oxr->latest();
You can use https instead
$oxr = new OpenExchangeRates("YOUR APP ID", ["https" => true]);
or if you wish, you can add a cache handler to cache your result
use OpenExchangeRatesWrapper\Caches\FileCache;
$fileCache = new FileCache();
$oxr = new OpenExchangeRates("YOUR APP ID", ["cacheHandler" => $fileCache);
OpenExchangeRates
new OpenExchangeRates($app_id, $options)
the only required argument for this constructor is $app_id. You need to register into https://openexchangerates.org.
$options : array with cacheHandler or https property. All is optional.
methods
|name|Description|
|------|------------|
|latest| calling the latest endpoint from openexchangerates|
|historical| call the historical endpoint from openexchangerates. pas YYYY-MM-DD as first argument|
|currencies|call currencies endpoint|
|timeSeries| call timeseries endpoint|
|convert|call convert endpoint. $oxr->convert($value, $from, $to)|
|ohlc||
|usage| get your openexchangerates api usage|
|nativeConvert| convert without calling convert endpoint api. $oxr->nativeConvert($value, $to, $from)|
FileCache
new FileCache($expiredAfter, $path)
All arguments here is optionals. $expiredAfter default is 24 hours. Use hours instead seconds.
ihfazhillah/php-openexchangerates-wrapper 适用场景与选型建议
ihfazhillah/php-openexchangerates-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.97k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ihfazhillah/php-openexchangerates-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ihfazhillah/php-openexchangerates-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-16