Skip to content

Commit

Permalink
Merge pull request #21 from imanilchaudhari/patch-01
Browse files Browse the repository at this point in the history
enh: restruct & readme file updated
  • Loading branch information
imanilchaudhari authored Jul 9, 2024
2 parents d0060b7 + 7a1765d commit dacbd12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Yii2 Currency Converter Change Log

## 3.1 Jul 9, 2024

- enh: restruct & readme file updated

## 3.0 Apr 6, 2024

- enh: removed obsolete providers & added new providers
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The preferred way to install this extension is through [composer](http://getcomp
Either run

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

or add
Expand Down Expand Up @@ -67,12 +67,11 @@ $rate = $converter->convert('USD', 'NPR');

```php
use imanilchaudhari\CurrencyConverter\CurrencyConverter;
use imanilchaudhari\CurrencyConverter\Provider\OpenExchangeRatesApi;
use imanilchaudhari\CurrencyConverter\Provider\ExchangeRatesApi;

$converter = new CurrencyConverter([
'provider' => [
'class' => OpenExchangeRatesApi::class,
'appId' => Yii::$app->params['openExchangeRate']['appId'],
'class' => ExchangeRatesApi::class,
],
]);
$rate = $converter->convert('USD', 'NPR');
Expand All @@ -87,7 +86,7 @@ Exchange Rate Providers
- [CurrencyApi](./src/Provider/CurrencyApi.php) - Get exchange rates from https://currencyapi.com/
- [CurrencyFreaksApi](./src/Provider/CurrencyFreaksApi.php) - Get exchange rates from https://currencyfreaks.com/
- [CurrencylayerApi](./src/Provider/CurrencylayerApi.php) - Get exchange rates from https://currencylayer.com/
- [ExchangeRatesApi](./src/Provider/ExchangeRatesApi.php) - Get exchange rates from https://www.exchangerate-api.com/
- [ExchangeRatesApi](./src/Provider/ExchangeRatesApi.php) - Get exchange rates from https://www.exchangerate-api.com/ (Free, no registration required)
- [FixerApi](./src/Provider/FixerApi.php) - Get exchange rates from https://fixer.io/
- [OpenExchangeRatesApi](./src/Provider/OpenExchangeRatesApi.php) - Get exchange rates from https://openexchangerates.org/

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/CurrencyConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function parseCurrencyArgument($data)
*/
protected function getCurrencyCode($countryCode)
{
$currencies = Json::decode(file_get_contents(__DIR__ . '/resources/codes.json'), true);
$currencies = Json::decode(file_get_contents(__DIR__ . '/data/codes.json'), true);
if (!array_key_exists($countryCode, $currencies)) {
throw new InvalidArgumentException(sprintf('Unsupported country code, %s', $countryCode));
}
Expand Down

0 comments on commit dacbd12

Please sign in to comment.