imanilchaudhari/yii2-currency-converter
最新稳定版本:3.2
Composer 安装命令:
composer require imanilchaudhari/yii2-currency-converter
包简介
This extension will help to find out current currency conversion rate.
关键字:
README 文档
README
Yii2 Currency Converter
This extension will help to find out current currency conversion rate using various providers.
Documentation is at docs/README.md.
Version 1 docs are located at here.
Requirements
- PHP version 7.4 or later
- Curl Extension (Optional)
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist imanilchaudhari/yii2-currency-converter "3.1"
or add
"imanilchaudhari/yii2-currency-converter": "3.1"
to the require section of your composer.json file.
Usage
Once the extension is installed, use it in your code by adding the below code on the config's components :
'components' => [ 'currencyConverter' => [ 'class' => 'imanilchaudhari\CurrencyConverter\CurrencyConverter', 'provider' => [ 'class' => 'imanilchaudhari\CurrencyConverter\Provider\ExchangeRatesApi', ], ], ... ],
and use as
$rate = Yii::$app->currencyConverter->convert('USD', 'NPR');
OR
use imanilchaudhari\CurrencyConverter\CurrencyConverter; use imanilchaudhari\CurrencyConverter\Provider\ExchangeRatesApi; $converter = new CurrencyConverter([ 'provider' => [ 'class' => ExchangeRatesApi::class, ], ]); $rate = $converter->convert('USD', 'NPR'); print_r($rate); // it will print the current Nepalese currency (NPR) rate according to USD
Exchange Rate Providers
- ApiForexApi - Get exchange rates from https://api.forex/
- CurrencyApi - Get exchange rates from https://currencyapi.com/
- CurrencyFreaksApi - Get exchange rates from https://currencyfreaks.com/
- CurrencylayerApi - Get exchange rates from https://currencylayer.com/
- ExchangeRatesApi - Get exchange rates from https://www.exchangerate-api.com/ (Free, no billing required)
- FixerApi - Get exchange rates from https://fixer.io/
- OpenExchangeRatesApi - Get exchange rates from https://openexchangerates.org/
- UniRateApi - Get exchange rates from https://unirateapi.com/ (Free, no credit card required.)
Testing
Unit testing
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
License
The Yii2 Currency Converter is free software. It is released under the terms of the MIT License. Please see LICENSE for more information.
统计信息
- 总下载量: 11.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-04