diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..748db18 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,39 @@ +name: PHPUnit Tests + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-version: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + tools: composer + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ~/.composer/cache + key: composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + composer-${{ matrix.php-version }}- + + - name: Install dependencies + run: composer update --no-interaction --prefer-dist + + - name: Run tests + run: composer test diff --git a/.gitignore b/.gitignore index b67b551..9f224f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ vendor composer.lock phpunit.xml -.phpunit.result.cache \ No newline at end of file +.phpunit.result.cache + +.idea/ \ No newline at end of file diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index d2c8bd1..70c5260 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -134,6 +134,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->append($this->createSimpleProviderNode('european_central_bank')) ->append($this->createSimpleProviderNode('national_bank_of_romania')) ->append($this->createSimpleProviderNode('russian_central_bank')) + ->append($this->createSimpleProviderNode('frankfurter')) + ->append($this->createSimpleProviderNode('fawazahmed_currency_api')) + ->append($this->createSimpleProviderNode('bulgarian_national_bank')) + ->append($this->createSimpleProviderNode('national_bank_of_ukraine')) ->arrayNode('currency_data_feed') ->children() ->integerNode('priority')->defaultValue(0)->end() diff --git a/DependencyInjection/FlorianvSwapExtension.php b/DependencyInjection/FlorianvSwapExtension.php index c473504..b43b71c 100644 --- a/DependencyInjection/FlorianvSwapExtension.php +++ b/DependencyInjection/FlorianvSwapExtension.php @@ -28,6 +28,8 @@ class FlorianvSwapExtension extends Extension { /** * {@inheritdoc} + * + * @return void */ public function load(array $config, ContainerBuilder $container) { diff --git a/README.md b/README.md index b69a532..8d557cd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Symfony Swap -[![Build status](http://img.shields.io/travis/florianv/symfony-swap.svg?style=flat-square)](https://travis-ci.org/florianv/symfony-swap) -[![Total Downloads](https://img.shields.io/packagist/dt/florianv/swap-bundle.svg?style=flat-square)](https://packagist.org/packages/florianv/swap-bundle) -[![Version](http://img.shields.io/packagist/v/florianv/swap-bundle.svg?style=flat-square)](https://packagist.org/packages/florianv/swap-bundle) +**This is a fork of [florianv/symfony-swap](https://github.com/florianv/symfony-swap) for the use in Part-DB.** + Swap allows you to retrieve currency exchange rates from various services such as **[Fixer](https://fixer.io/)**, **[Currency Data](https://currencylayer.com)** or **[Exchange Rates Data](https://exchangeratesapi.io)** and optionally cache the results. @@ -27,7 +26,7 @@ or **[Exchange Rates Data](https://exchangeratesapi.io)** and optionally cache t ## QuickStart ```bash -$ composer require florianv/swap-bundle php-http/message php-http/guzzle6-adapter ^1.0 +$ composer require part-db/swap-bundle php-http/message php-http/guzzle6-adapter ^1.0 ``` ## Documentation diff --git a/composer.json b/composer.json index 15546ba..8e82806 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "florianv/swap-bundle", + "name": "part-db/swap-bundle", "type": "symfony-bundle", - "description": "Integrates the Swap library with Symfony", + "description": "Fork of florianv/swap-bundle, modernized for use with Part-DB. Integrates the Swap library with Symfony", "keywords": ["money", "currency", "conversion", "rate", "exchange", "symfony", "bundle"], "homepage": "https://github.com/florianv/FlorianvSwapBundle", "license": "MIT", @@ -10,6 +10,10 @@ "name": "Florian Voutzinos", "email": "florian@voutzinos.com", "homepage": "http://florian.voutzinos.com/" + }, + { + "name": "Jan Böhmer", + "email": "mail@jan-boehmer.de" } ], "scripts": { @@ -18,14 +22,17 @@ "require": { "php": "^7.1.3|^8.0", "symfony/framework-bundle": "~3.0|~4.0|~5.0|~6.0|~7.0", - "florianv/swap": "^4.0" + "part-db/swap": "^5.0", + "part-db/exchanger": "^3.1.0", + "psr/http-client": "^1.0" }, "require-dev": { "php-http/guzzle6-adapter": "^1.0", "php-http/message": "^1.7", "symfony/cache": "~3.0|~4.0|~5.0|~6.0|~7.0", "phpunit/phpunit": "~5.7|~6.0|~7.0|~8.0|~9.0", - "nyholm/psr7": "^1.1" + "nyholm/psr7": "^1.1", + "symfony/http-client": "~7.0|~6.0|~5.0" }, "suggest": { "symfony/cache": "For caching" @@ -39,5 +46,10 @@ "branch-alias": { "dev-master": "5.0-dev" } + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } }