定制 umpirsky/locurro 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

umpirsky/locurro

最新稳定版本:0.2.0

Composer 安装命令:

composer require umpirsky/locurro

包简介

Local currency converter.

README 文档

README

symfony upgrade fixertwig gettext extractorwisdomcentipedepermissions handlerextraloadgravatarlocurrocountry listtransliterator

Locurro Build Status

💶 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:

us fr

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 XigniteGlobalCurrencies API. 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.
  • Array Retrieves 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.

统计信息

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

GitHub 信息

  • Stars: 34
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: propertary
  • 更新时间: 2015-08-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固