Skip to content

Commit

Permalink
Merge pull request #24 from worksome/feature/frankfurter
Browse files Browse the repository at this point in the history
feat: prepare for 2.x release
  • Loading branch information
owenvoke authored Mar 22, 2024
2 parents 216d406 + d07f686 commit 30b2f74
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHPStan
name: Static Analysis

on:
push:
Expand All @@ -8,7 +8,7 @@ on:

jobs:
phpstan:
name: phpstan
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: run-tests
name: Tests

on:
push:
Expand Down
32 changes: 0 additions & 32 deletions CHANGELOG.md

This file was deleted.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 5 additions & 5 deletions config/exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Supported: 'null', 'fixer', 'exchange_rate', 'frankfurter', 'cache'
*/

'default' => env('EXCHANGE_DRIVER', 'exchange_rate'),
'default' => env('EXCHANGE_DRIVER', 'frankfurter'),

'services' => [

Expand Down Expand Up @@ -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'),
],
],

Expand Down
2 changes: 1 addition & 1 deletion src/Facades/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
1 change: 0 additions & 1 deletion src/Support/ExchangeRateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 30b2f74

Please sign in to comment.