viewflex/forex
Composer 安装命令:
composer require viewflex/forex
包简介
Providing live currency exchange rates in Laravel and Lumen, with configurable provider and caching.
README 文档
README
Providing live currency exchange rates in Laravel and Lumen, with configurable provider and caching.
Overview
For live currency exchange rates, your choice of provider depends on various factors, including pricing, features, and reliability, which sometimes change. The purpose of this package is to provide a fixed exchange rate endpoint for your application, which can be configured to use one of the various popular providers, and re-configured at any time to use a different provider if necessary.
Installation
Via Composer:
$ composer require viewflex/forex
Configuration
Configuration values must be specified in the application's .env file, or in your environment's $_ENV or $_SERVER arrays - all of these options are supported transparently. Below are sample configurations for the currently supported providers. You can also customize the cache refresh interval as described below.
Supported Providers
Currency Converter API (free)
FOREX_PROVIDER=CurrencyConverterApiFree
FOREX_PROVIDER_URL=http://free.currencyconverterapi.com/api/v6/convert
Currency Converter API (paid)
FOREX_PROVIDER=CurrencyConverterApi
FOREX_PROVIDER_URL=https://api.currencyconverterapi.com/api/v6/convert
FOREX_PROVIDER_KEY=<your-provider-key>
Fixer (free and paid)
FOREX_PROVIDER=Fixer
FOREX_PROVIDER_URL=https://data.fixer.io/api/latest
FOREX_PROVIDER_KEY=<your-provider-key>
*The free subscription supports only EUR as the base currency.
Open Exchange Rates (free and paid)
FOREX_PROVIDER=OpenExchangeRates
FOREX_PROVIDER_URL=https://openexchangerates.org/api/latest.json
FOREX_PROVIDER_KEY=<your-provider-key>
*The free subscription supports only USD as the base currency.
Caching
Use the FOREX_CACHE_MINUTES environment variable to specify how long a rate is cached. Unless specified, the default of 720 (12 hours) is used. Setting this variable to 0 disables caching of rates. Using a longer cache refresh interval can help you to avoid interruption of service (or extra charges if using a paid service).
Usage
$server = new \Viewflex\Forex\Forex(); echo $server->getRate('USD', 'CAD');
Tests
Tests can be run as described in the test documentation.
License
This software is offered for use under the MIT License.
Changelog
Release versions are tracked in the Changelog.
viewflex/forex 适用场景与选型建议
viewflex/forex 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.37k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「money」 「currency」 「conversion」 「forex」 「exchange rate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 viewflex/forex 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 viewflex/forex 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 viewflex/forex 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Beyonic PHP Library
A library that provides a simple infrastructure to create your own converters and to perform any conversion you want
Fixer.io data provider for Peso
TCMB Currenct Converter
Color conversion library
Convert and serve jpeg/png to webp with PHP (if at all possible)
统计信息
- 总下载量: 4.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-03