Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Open Exchange Rates provider #3

Merged
merged 1 commit into from Nov 22, 2017

Conversation

@chaimleich
Copy link
Contributor

commented Nov 22, 2017

Adds the ability to use this extension with an Open Exchange Rates account.

To use this, I extended the CurrencyConverter class in my project and overrode the getRateProvider function. Example:


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;
    }
}
Added Open Exchange Rates provider
Adds the ability to use this extension with an Open Exchange Rates account.

To use this, I extended the CurrencyConverter class in my project and overrode the `getRateProvider` function. Example:

```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;
    }
}
```

@imanilchaudhari imanilchaudhari merged commit d664b85 into imanilchaudhari:master Nov 22, 2017

@imanilchaudhari

This comment has been minimized.

Copy link
Owner

commented Nov 22, 2017

@chaimleich thanks for pull request. Did you have any idea ablut this issue. Created by @hootsy

@chaimleich

This comment has been minimized.

Copy link
Contributor Author

commented Nov 22, 2017

@imanilchaudhari I just discovered it today and quickly created a new provider for OER. It's already running in a production environment.

@imanilchaudhari

This comment has been minimized.

Copy link
Owner

commented Nov 22, 2017

@chaimleich Okay it seems cool to me. I will verify it. And if applicable I will update this extension soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.