From d2f8b7bf4181cfccdfc3f0e8b6851975a38dca17 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Fri, 22 Mar 2024 10:28:29 +0000 Subject: [PATCH 1/2] feat: change the default driver to Frankfurter.app --- config/exchange.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/exchange.php b/config/exchange.php index b9df322..93260d0 100644 --- a/config/exchange.php +++ b/config/exchange.php @@ -11,7 +11,7 @@ * Supported: 'null', 'fixer', 'exchange_rate', 'frankfurter', 'cache' */ - 'default' => env('EXCHANGE_DRIVER', 'exchange_rate'), + 'default' => env('EXCHANGE_DRIVER', 'frankfurter'), 'services' => [ @@ -58,10 +58,10 @@ */ 'cache' => [ - 'strategy' => 'exchange_rate', - 'ttl' => 60 * 60 * 24, // 24 hours - 'key' => 'cached_exchange_rates', - 'store' => null, + 'strategy' => env('EXCHANGE_RATES_CACHE_STRATEGY', 'frankfurter'), + 'ttl' => env('EXCHANGE_RATES_CACHE_TTL', 60 * 60 * 24), // 24 hours + 'key' => env('EXCHANGE_RATES_CACHE_KEY', 'cached_exchange_rates'), + 'store' => env('EXCHANGE_RATES_CACHE_STORE'), ], ], From d07f68657fca345405d068f15b593e9dc2e47377 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Fri, 22 Mar 2024 10:32:36 +0000 Subject: [PATCH 2/2] chore: prepare for v2.x release --- .github/workflows/{phpstan.yml => static.yml} | 4 +-- .../workflows/{run-tests.yml => tests.yml} | 2 +- CHANGELOG.md | 32 ------------------- README.md | 10 +++--- composer.json | 2 +- src/Facades/Exchange.php | 2 +- src/Support/ExchangeRateManager.php | 1 - 7 files changed, 11 insertions(+), 42 deletions(-) rename .github/workflows/{phpstan.yml => static.yml} (91%) rename .github/workflows/{run-tests.yml => tests.yml} (99%) delete mode 100644 CHANGELOG.md diff --git a/.github/workflows/phpstan.yml b/.github/workflows/static.yml similarity index 91% rename from .github/workflows/phpstan.yml rename to .github/workflows/static.yml index fc6c48e..6214d6e 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/static.yml @@ -1,4 +1,4 @@ -name: PHPStan +name: Static Analysis on: push: @@ -8,7 +8,7 @@ on: jobs: phpstan: - name: phpstan + name: PHPStan runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/tests.yml similarity index 99% rename from .github/workflows/run-tests.yml rename to .github/workflows/tests.yml index dd547e7..f239fb7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: run-tests +name: Tests on: push: diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index fbbd78f..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,32 +0,0 @@ -# Changelog - -All notable changes to `exchange` will be documented in this file. - -## v1.2.0 - 2022-07-21 - -### Changed -- Updated console output [#8](https://github.com/worksome/exchange/pull/8) - -## v1.1.1 - 2022-04-14 - -### Fixes -- Fixes a small issue with types - -## v1.1.0 - 2022-04-14 - -### Added -- Added support for frankfurter.app [#7](https://github.com/worksome/exchange/pull/7) - -## v1.0.0 - 2022-03-03 - -### Added -- Added all supported currencies [#5](https://github.com/worksome/exchange/pull/5) - -## v0.2.0 - 2022-02-23 - -### Added -- Support for [exchangerate.host](http://exchangerate.host/) as an exchange rate driver [#4](https://github.com/worksome/exchange/pull/4) - -## v0.1.0 - 2022-02-23 - -- initial release diff --git a/README.md b/README.md index 3053c62..3bfc3da 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,10 @@ Check exchange rates for any currency in Laravel -[![Tests](https://github.com/worksome/exchange/actions/workflows/run-tests.yml/badge.svg)](https://github.com/worksome/exchange/actions/workflows/run-tests.yml) -[![PHPStan](https://github.com/worksome/exchange/actions/workflows/phpstan.yml/badge.svg)](https://github.com/worksome/exchange/actions/workflows/phpstan.yml) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/worksome/exchange.svg?style=flat-square)](https://packagist.org/packages/worksome/exchange) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/worksome/exchange/tests.yml?branch=main&style=flat-square&label=Tests)](https://github.com/worksome/exchange/actions?query=workflow%3ATests+branch%3Amain) +[![GitHub Static Analysis Action Status](https://img.shields.io/github/actions/workflow/status/worksome/exchange/static.yml?branch=main&style=flat-square&label=Static%20Analysis)](https://github.com/worksome/exchange/actions?query=workflow%3A"Static%20Analysis"+branch%3Amain) +[![Total Downloads](https://img.shields.io/packagist/dt/worksome/exchange.svg?style=flat-square)](https://packagist.org/packages/worksome/exchange) If your app supports multi-currency, you'll no doubt need to check exchange rates. There are many third party services to accomplish this, but why bother reinventing the wheel when we've done all the hard work for you? @@ -91,7 +93,7 @@ In your `exchange.php` config file, set `default` to `cache`, or set `EXCHANGE_D You'll also want to pick a strategy under `services.cache.strategy`. By default, this will be `fixer`, but you are free to change that. The strategy is the service that will be used to perform the exchange rate lookup when nothing is found in the cache. -There is also the option to override the `ttl` (how many seconds rates are cached for) and `key` for your cached rates. +There is also the option to override the `ttl` (how many seconds rates are cached for), `key` for your cached rates, and the `store`. ## Artisan @@ -130,7 +132,7 @@ composer test ## Changelog -Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. +Please see [GitHub Releases](https://github.com/worksome/exchange/releases) for more information on what has changed recently. ## Credits diff --git a/composer.json b/composer.json index 953aeca..664735d 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "orchestra/testbench": "^8.0 || ^9.0", "pestphp/pest": "^2.33", "pestphp/pest-plugin-laravel": "^2.2", - "worksome/coding-style": "^2.8" + "worksome/coding-style": "^2.10" }, "autoload": { "psr-4": { diff --git a/src/Facades/Exchange.php b/src/Facades/Exchange.php index 7ed5868..7470969 100644 --- a/src/Facades/Exchange.php +++ b/src/Facades/Exchange.php @@ -20,9 +20,9 @@ final class Exchange extends Facade */ public static function fake(array $rates = []): void { - /** * @var \Worksome\Exchange\Exchange $fake + * * @phpstan-ignore-next-line */ $fake = self::$app->instance(\Worksome\Exchange\Exchange::class, self::getFacadeRoot()); diff --git a/src/Support/ExchangeRateManager.php b/src/Support/ExchangeRateManager.php index 04b29ff..de3b814 100644 --- a/src/Support/ExchangeRateManager.php +++ b/src/Support/ExchangeRateManager.php @@ -4,7 +4,6 @@ namespace Worksome\Exchange\Support; -use Illuminate\Cache\Repository; use Illuminate\Contracts\Cache\Factory as CacheFactory; use Illuminate\Http\Client\Factory; use Illuminate\Support\Manager;