umpirsky/locurro
Composer 安装命令:
composer require umpirsky/locurro
包简介
Local currency converter.
README 文档
README
symfony upgrade fixer • twig gettext extractor • wisdom • centipede • permissions handler • extraload • gravatar • locurro • country list • transliterator
Locurro 
💶 Local currency converter.
Use Case
Imagine you have an online store, and you are selling products in many different countries. Some of your buyers might live in country that uses currency other then one you use in your store. It would be cool to give them estimation of product costs in their domestic currency.
Here is one example of showing approximate price under the brackets:
And it automatically detects users default currency based on their IP address for example.
Pretty cool, huh? 😄
Basic Usage
Convert based on currency
<?php /* @var $converter Locurro\Converter\Currency */ $converter->convert( new Money\Money(100, new Money\Currency('EUR')), new Money\Currency('RSD') );
Full example in examples/currency.php.
Convert based on locale
<?php /* @var $converter Locurro\Converter\Locale */ $converter->convert( new Money\Money(100, new Money\Currency('EUR')), 'sr-Cyrl-RS' );
Full example in examples/locale.php.
Convert based on country
<?php /* @var $converter Locurro\Converter\Country */ $converter->convert( new Money\Money(100, new Money\Currency('EUR')), 'RS' );
Full example in examples/country.php.
Convert based on IP address
<?php /* @var $converter Locurro\Converter\IpAddress */ $converter->convert( new Money\Money(100, new Money\Currency('EUR')), '109.92.115.78' );
Full example in examples/ip.php.
Advanced Usage
Chaining providers
Locurro uses Swap library for exchange rates.
There are multiple exchange rate providers supported:
- European Central Bank Supports only EUR as base currency.
- Google Finance Supports multiple currencies as base and quote currencies.
- Open Exchange Rates Supports only USD as base currency for the free version and multiple ones for the enterprise version.
- Xignite
You must have access to the
XigniteGlobalCurrenciesAPI. Supports multiple currencies as base and quote currencies. - Yahoo Finance Supports multiple currencies as base and quote currencies.
- WebserviceX Supports multiple currencies as base and quote currencies.
- National Bank of Romania Supports only RON as base currency.
ArrayRetrieves rates from a PHP array.
You can chain them, see example in examples/ip-chained.php.
Caching
You can cache exchange rates using Doctrine cache or Illuminate cache.
Example is available in examples/ip-cached.php.
Twig integration
There is a Twig extension provded in the source code.
umpirsky/locurro 适用场景与选型建议
umpirsky/locurro 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 49 次下载、GitHub Stars 达 34, 最近一次更新时间为 2015 年 08 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 umpirsky/locurro 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 umpirsky/locurro 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 34
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: propertary
- 更新时间: 2015-08-31

