2017 © Pedro Peláez
 

yii2-extension yii2-currency-converter

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

image

imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

  • Sunday, April 8, 2018
  • by imanilchaudhari
  • Repository
  • 2 Watchers
  • 11 Stars
  • 6,822 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

, (*1)

Yii2 Currency Converter


Latest Stable Version Total Downloads Build Status Code Coverage, (*2)

This extension will help to find out current currency conversion rate using various providers., (*3)

Documentation is at docs/README.md., (*4)

Version 1 docs are located at here., (*5)

Requirements

  • PHP version 7.4 or later
  • Curl Extension (Optional)

Installation

The preferred way to install this extension is through composer., (*6)

Either run, (*7)

php composer.phar require --prefer-dist imanilchaudhari/yii2-currency-converter "3.1"

or add, (*8)

"imanilchaudhari/yii2-currency-converter": "3.1"

to the require section of your composer.json file., (*9)

Usage

Once the extension is installed, use it in your code by adding the below code on the config's components :, (*10)

'components' => [
    'currencyConverter' => [
        'class' => 'imanilchaudhari\CurrencyConverter\CurrencyConverter',
        'provider' => [
            'class' => 'imanilchaudhari\CurrencyConverter\Provider\ExchangeRatesApi',
        ],
    ],
    ...
],

****and use as****, (*11)

$rate = Yii::$app->currencyConverter->convert('USD', 'NPR');

OR, (*12)

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/

Testing

Unit testing

The package is tested with PHPUnit. To run tests:, (*13)

./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., (*14)

Powered by, (*15)

The Versions

08/04 2018

dev-master

9999999-dev

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

  Sources   Download

MIT

The Requires

 

extension yii2

08/04 2018

1.1

1.1.0.0

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

  Sources   Download

MIT

The Requires

 

extension yii2

08/04 2018

dev-development

dev-development

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

  Sources   Download

MIT

The Requires

 

extension yii2

10/09 2015

1.0

1.0.0.0

This extension will help to find out current currency conversion rate. This extension uses Yahoo's currency conversion API

  Sources   Download

MIT

The Requires

 

extension yii2