承接 ranium/laravel-fixerio 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ranium/laravel-fixerio

最新稳定版本:v1.2.0

Composer 安装命令:

composer require ranium/laravel-fixerio

包简介

Laravel package/client for fixer.io api, a foreign exchange rates and currency conversion API.

README 文档

README

Build Status Total Downloads Latest Stable Version License

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.

统计信息

  • 总下载量: 36.42k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-05