hexcores/currency
最新稳定版本:0.0.5
Composer 安装命令:
composer require hexcores/currency
包简介
Currency converter library
README 文档
README
Currency package is easy to use multiple currency value (format) at your application. (eg: E-Commerce)
Package Dependencies
- "php": ">=5.3.0"
Exchange Services
- (CentralBankMyanmarExchange) Excahange rate from Cental Bank of Myanmar API.
Formatter Services
- BaseFormatter
Supported Currency Types
- AUD (Australian dollar)
- CNY (Chinese renminbi)
- EUR (European Euro)
- GBP (Pound Sterling)
- JPY (Japanese yen)
- MMK (Myanmar Kyats)
- SGD (Singapore Dollar)
- THB (Thai Baht)
- USD (US Dollar)
Install
You can install currency package from composer
{
"require": {
"hexcores/currency": "dev-master"
}
}
Usage
use Hexcores\Currency\Type; use Hexcores\Currency\Converter; use Hexcores\Currency\Http\Client; use Hexcores\Currency\Formatter\BaseFormatter; use Hexcores\Currency\Exchange\CentralBankMyanmarExchange; $ex = new CentralBankMyanmarExchange(new Client()); $f = new BaseFormatter(); $converter = new Converter($ex, $f); echo "Convert : ". $converter->convert(2500, Type::USD, Type::MMK); echo "<br>Convert AUD: ". $converter->convert(2500, Type::USD, Type::AUD);
Use central bank exchange with factory
use Hexcores\Currency\Type; use Hexcores\Currency\Factory; $converter = Factory::centralBank(); echo "Convert : ". $converter->convert(2500, Type::USD, Type::MMK); echo "<br>Convert AUD: ". $converter->convert(2500, Type::USD, Type::AUD);
Example
You can run example.php file from example folder.
Testing
$ phpunit
Contributing
TODO
统计信息
- 总下载量: 86
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-15