d3catalyst/exchangerate

两种货币之间的货币汇率转换包

1.0.1 2014-07-28 23:25 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:14:45 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

Laravel 4 库,用于调用 http://rate-exchange.appspot.com/currency API。

此库提供了一个简单的方法来执行货币转换,这是电子商务系统中非常需要的应用。

只需安装此包,添加配置,即可使用!

要求

  • PHP >= 5.3.7
  • cURL 扩展

安装

Add in composer.json
"d3catalyst/exchangerate": "dev-master"

在您的 config/app.php 中添加服务提供者和外观

服务提供者

D3Catalyst\Exchangerate\Laravel4\ServiceProviders\ExchangerateServiceProvider

外观

'Exchange'           => 'D3Catalyst\Exchangerate\Laravel4\Facades\Exchangerate',

用法

- Usage with default setters

Set initial config
	Exchange::setCurrency('DLS','EUR');

Get exchange value / return int or float value
	Exchange::getExchangeValue();

- Usage with independent setters

Set country currency code from
	Exchange::setCurrencyFrom($currency);

Set country currency code to
	Exchange::setCurrencyTo($currency);

Set amount - number
	Exchange::setAmount($amount);

Get exchange value / return int or float value
	Exchange::getExchangeValue();

- Common

Get full exchange rate information
	Exchange::getExchangeRateInfo();