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

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

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

ranium/fixerio-php-client

最新稳定版本:v1.2.0

Composer 安装命令:

composer require ranium/fixerio-php-client

包简介

A PHP client for fixer.io foreign exchange rates and currency conversion API.

README 文档

README

Build Status Total Downloads Latest Stable Version License

Fixer.io PHP Client

Provides an easy to use client for fixer.io exchange rates and currency conversion JSON API.

Looking for a Laravel package? Please use ranium/laravel-fixerio instead of this library.

Installation

This project can be installed using Composer:

composer require ranium/fixerio-php-client

Usage

This package uses's Guzzle's Service Description to make HTTP Requests to the fixer.io API.

To use this package in your application, simply use the package and instantiate the client as follows

use Ranium\Fixerio\Client; $accessKey = '12345678901234567890'; $secure = true; // Optional, default is true (only paid plans of fixer.io supports SSL) $config = []; // Optional, guzzle command client config that you might want to pass $fixerio = Client::create($accessKey, $secure, $config);

Here's how you can access the fixer.io's endpoints:

Note: access_key parameter is sent by default in all requests so no need to pass it in the argument while calling methods. However, you can include it should you want to override the access key used while instantiating the fixerio client.

Latest rates endpoint

$latestRates = $fixerio->latest( [ 'base' => 'USD', // optional 'symbols' => 'INR', // optional ] ); // Display the INR rates echo $latestRates['rates']['INR'];

Historical rates endpoint

$historicalRates = $fixerio->historical( [ 'date' => '2019-01-01', 'base' => 'USD', // optional 'symbols' => 'INR', //optional ] ); // Display the INR rates echo $latestRates['rates']['INR'];

Convert endpoint

$convertedRates = $fixerio->convert( [ 'from' => 'USD', 'to' => 'INR', 'amount' => 50.75, 'date' => '2019-01-01', //optional ] ); // Display the converted amount echo $convertedRates['result'];

Time-Series data endpoint

$timeseriesData = $fixerio->timeseries( [ 'start_date' => '2019-01-01', 'end_date' => '2019-01-05', 'base' => 'USD', // optional 'symbols' => 'INR', //optional ] ); // Display the INR rate for 2019-01-02 echo $timeseriesData['rates']['2019-01-02']['INR'];

Fluctuation data endpoint

$fluctuationData = $fixerio->fluctuation( [ 'start_date' => '2019-01-01', 'end_date' => '2019-01-05', 'base' => 'USD', // optional 'symbols' => 'INR', //optional ] ); // Display the change/fluctuation amount of INR between the given date range echo $fluctuationData['rates']['INR']['change'];

The response for all the above calls will be a JSON 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.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固