diff --git a/Provider/CurrencylayerApi.php b/Provider/CurrencylayerApi.php new file mode 100644 index 0000000..371f3bd --- /dev/null +++ b/Provider/CurrencylayerApi.php @@ -0,0 +1,45 @@ +rateProvider) { + $this->setRateProvider(new FixerApi()); + } + + return $this->rateProvider; + } +} +``` \ No newline at end of file diff --git a/docs/OpenExchangeRatesApi.md b/docs/OpenExchangeRatesApi.md new file mode 100644 index 0000000..bbe9258 --- /dev/null +++ b/docs/OpenExchangeRatesApi.md @@ -0,0 +1,25 @@ +Open Exchange Rates APi Integration +----------------------------------- +Here is a code snippets suggested by [chaimleich](https://github.com/chaimleich) on [this pull request](https://github.com/imanilchaudhari/yii2-currency-converter/pull/3). +```php + +use Yii; +use imanilchaudhari\CurrencyConverter\Provider\OpenExchangeRatesApi; + +class CurrencyConverter extends \imanilchaudhari\CurrencyConverter\CurrencyConverter +{ + /** + * @inheritdoc + */ + public function getRateProvider() + { + if (!$this->rateProvider) { + $this->setRateProvider(new OpenExchangeRatesApi([ + 'appId' => Yii::$app->params['openExchangeRate']['appId'], + ])); + } + + return $this->rateProvider; + } +} +``` \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..bbe9258 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,25 @@ +Open Exchange Rates APi Integration +----------------------------------- +Here is a code snippets suggested by [chaimleich](https://github.com/chaimleich) on [this pull request](https://github.com/imanilchaudhari/yii2-currency-converter/pull/3). +```php + +use Yii; +use imanilchaudhari\CurrencyConverter\Provider\OpenExchangeRatesApi; + +class CurrencyConverter extends \imanilchaudhari\CurrencyConverter\CurrencyConverter +{ + /** + * @inheritdoc + */ + public function getRateProvider() + { + if (!$this->rateProvider) { + $this->setRateProvider(new OpenExchangeRatesApi([ + 'appId' => Yii::$app->params['openExchangeRate']['appId'], + ])); + } + + return $this->rateProvider; + } +} +``` \ No newline at end of file diff --git a/docs/YahooApi.md b/docs/YahooApi.md new file mode 100644 index 0000000..bbe9258 --- /dev/null +++ b/docs/YahooApi.md @@ -0,0 +1,25 @@ +Open Exchange Rates APi Integration +----------------------------------- +Here is a code snippets suggested by [chaimleich](https://github.com/chaimleich) on [this pull request](https://github.com/imanilchaudhari/yii2-currency-converter/pull/3). +```php + +use Yii; +use imanilchaudhari\CurrencyConverter\Provider\OpenExchangeRatesApi; + +class CurrencyConverter extends \imanilchaudhari\CurrencyConverter\CurrencyConverter +{ + /** + * @inheritdoc + */ + public function getRateProvider() + { + if (!$this->rateProvider) { + $this->setRateProvider(new OpenExchangeRatesApi([ + 'appId' => Yii::$app->params['openExchangeRate']['appId'], + ])); + } + + return $this->rateProvider; + } +} +``` \ No newline at end of file