ranium/laravel-fixerio
Composer 安装命令:
composer require ranium/laravel-fixerio
包简介
Laravel package/client for fixer.io api, a foreign exchange rates and currency conversion API.
README 文档
README
Laravel Fixer.io
Provides an easy to use Laravel package for fixer.io exchange rates and currency conversion JSON API. This is basically a Laravel wrapper for ranium/fixerio-php-client.
Installation
Run the following from the root of your Laravel app
composer require ranium/laravel-fixerio
Configuration
Publish the config file
php artisan vendor:publish --tag=laravel-fixerio
Edit the config/fixerio.php and put your access key and tweak other config options as needed. Note that the secure option works only with the paid plans of fixer.io.
Usage
// Resolve the client class instance out of the service container $fixerio = app(\Ranium\LaravelFixerio\Client::class); // Find latest rates $latestRates = $fixerio->latest(); echo $latestRates['rates']['INR']; // Find historical rates $historicalRates = $fixerio->historical(['date' => '2019-01-01']); echo $historicalRates['rates']['INR'];
You can use the provided Facade as well
use Fixerio; $latestRates = Fixerio::latest();
As there is a hard limit on number of requests you can make to fixer.io, this package provides an easy way to cache the responses. Default cache storage is used for caching.
Modify the config/fixerio.php to enable the caching.
'cache' => [ 'enabled' => true, 'expire_after' => 60, // In minutes, change this as per requirement ];
You can disable cache in the runtime.
use Fixerio; Fixerio::disableCache(); $latestRates = Fixerio::latest(); // Enable cache again for other calls Fixerio::enableCache(); // Other calls to the API...
Please refer ranium/fixerio-php-client for all available API calls and other details.
The response for all the above calls will be a Guzzle Command Result object. Please refer fixer.io's documentation for further details about various endpoints, request parameters and response objects.
License
This package is open-sourced software licensed under the MIT license.
ranium/laravel-fixerio 适用场景与选型建议
ranium/laravel-fixerio 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.84k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2019 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ranium/laravel-fixerio 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ranium/laravel-fixerio 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 37.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-05