Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit cf1afeb

Browse files
author
Andrey Helldar
authored
Merge pull request #67 from TheDragonCode/9.x
Added Symfony 6 and Laravel 9 support
2 parents 2007ac3 + c7ed84a commit cf1afeb

File tree

16 files changed

+308
-97
lines changed

16 files changed

+308
-97
lines changed

.codecov.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: laravel
1+
name: "Laravel 7"
22
on: [ push ]
33

44
jobs:
@@ -9,10 +9,9 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
php: [ "7.3", "7.4", "8.0" ]
12-
laravel: [ "8.0" ]
13-
support: [ "5.0" ]
12+
laravel: [ "7.0" ]
1413

15-
name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }}, Support ${{ matrix.support }}
14+
name: PHP ${{ matrix.php }}
1615

1716
steps:
1817
- name: Checkout code
@@ -25,13 +24,8 @@ jobs:
2524
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
2625
coverage: none
2726

28-
- name: Composer self update
29-
run: composer self-update
30-
3127
- name: Install dependencies
32-
run: |
33-
composer require laravel/framework:^${{ matrix.laravel }} dragon-code/support:^${{ matrix.support }}
34-
composer update --prefer-stable --prefer-dist --no-progress --no-interaction
28+
run: composer require laravel/framework:^${{ matrix.laravel }}
3529

3630
- name: Execute tests
3731
run: sudo vendor/bin/phpunit tests/Laravel

.github/workflows/laravel-8.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Laravel 8"
2+
on: [ push ]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ "7.3", "7.4", "8.0", "8.1" ]
12+
laravel: [ "8.0" ]
13+
14+
name: PHP ${{ matrix.php }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
25+
coverage: none
26+
27+
- name: Install dependencies
28+
run: composer require laravel/framework:^${{ matrix.laravel }}
29+
30+
- name: Execute tests
31+
run: sudo vendor/bin/phpunit tests/Laravel

.github/workflows/laravel-9.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Laravel 9"
2+
on: [ push ]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ "8.0", "8.1" ]
12+
laravel: [ "9.0" ]
13+
14+
name: PHP ${{ matrix.php }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
25+
coverage: none
26+
27+
- name: Install dependencies
28+
run: composer require laravel/framework:^${{ matrix.laravel }}
29+
30+
- name: Execute tests
31+
run: sudo vendor/bin/phpunit tests/Laravel
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: symfony
1+
name: "Symfony 4"
22
on: [ push ]
33

44
jobs:
@@ -9,10 +9,9 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
php: [ "7.3", "7.4", "8.0" ]
12-
symfony: [ "4.0", "5.0" ]
13-
support: [ "5.0" ]
12+
symfony: [ "4.0" ]
1413

15-
name: Symfony ${{ matrix.symfony }}, PHP ${{ matrix.php }}, Support ${{ matrix.support }}
14+
name: PHP ${{ matrix.php }}
1615

1716
steps:
1817
- name: Checkout code
@@ -25,13 +24,8 @@ jobs:
2524
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
2625
coverage: none
2726

28-
- name: Composer self update
29-
run: composer self-update
30-
3127
- name: Install dependencies
32-
run: |
33-
composer require symfony/http-foundation:^${{ matrix.symfony }} dragon-code/support:^${{ matrix.support }}
34-
composer update --prefer-stable --prefer-dist --no-progress --no-interaction
28+
run: composer require symfony/http-foundation:^${{ matrix.symfony }} --no-progress --no-interaction
3529

3630
- name: Execute tests
3731
run: sudo vendor/bin/phpunit tests/Symfony

.github/workflows/symfony-5.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Symfony 5"
2+
on: [ push ]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ "7.3", "7.4", "8.0", "8.1" ]
12+
symfony: [ "5.0" ]
13+
14+
name: PHP ${{ matrix.php }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
25+
coverage: none
26+
27+
- name: Install dependencies
28+
run: composer require symfony/http-foundation:^${{ matrix.symfony }} --no-progress --no-interaction
29+
30+
- name: Execute tests
31+
run: sudo vendor/bin/phpunit tests/Symfony

.github/workflows/symfony-6.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Symfony 6"
2+
on: [ push ]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ "8.0", "8.1" ]
12+
symfony: [ "6.0" ]
13+
14+
name: PHP ${{ matrix.php }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
25+
coverage: none
26+
27+
- name: Install dependencies
28+
run: composer require symfony/http-foundation:^${{ matrix.symfony }} --no-progress --no-interaction
29+
30+
- name: Execute tests
31+
run: sudo vendor/bin/phpunit tests/Symfony

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Instead, you may of course manually update your `require` block and run `compose
3636
```json
3737
{
3838
"require": {
39-
"dragon-code/api-response": "^9.0"
39+
"dragon-code/api-response": "^9.1"
4040
}
4141
}
4242
```
@@ -46,15 +46,15 @@ Alright! Use `api_response()` helper.
4646

4747
### Compatibility table
4848

49-
| Package version | PHP min version | Symfony version | Support | Links |
50-
|:---:|:---:|:---:|:---|:---|
51-
| ^9.0 | 7.2.5 | ^4.0, ^5.0 | ![Supported][badge_supported] | [Upgrade guide](.upgrading/8.x_9.x.md) |
52-
| ^8.0 | 7.2.5 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/7.x_8.x.md) |
53-
| ^7.0 | 7.2.5 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/6.x_7.x.md) |
54-
| ^6.0 | 7.3 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/5.x_6.x.md) |
55-
| ^5.0 | 7.1.3 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | --- |
56-
| ^4.4.1 | 5.6.9 | ^3.0, ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | --- |
57-
| ^4.0 | 5.6.9 | ^3.0, ^4.0 | ![Not Supported][badge_not_supported] | --- |
49+
| Package version | PHP min version | Symfony version | Support | Links |
50+
|:---------------:|:---------------:|:----------------:|:--------------------------------------|:---------------------------------------|
51+
| ^9.0 | 7.2.5 | ^4.0, ^5.0, ^6.0 | ![Supported][badge_supported] | [Upgrade guide](.upgrading/8.x_9.x.md) |
52+
| ^8.0 | 7.2.5 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/7.x_8.x.md) |
53+
| ^7.0 | 7.2.5 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/6.x_7.x.md) |
54+
| ^6.0 | 7.3 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | [Upgrade guide](.upgrading/5.x_6.x.md) |
55+
| ^5.0 | 7.1.3 | ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | --- |
56+
| ^4.4.1 | 5.6.9 | ^3.0, ^4.0, ^5.0 | ![Not Supported][badge_not_supported] | --- |
57+
| ^4.0 | 5.6.9 | ^3.0, ^4.0 | ![Not Supported][badge_not_supported] | --- |
5858

5959
[[ to top ]](#api-response)
6060

@@ -733,10 +733,11 @@ return with code 405:
733733

734734
If you use the Laravel or Lumen framework, you can update the `extends` in the `app\Exceptions\Handler.php` file depending on your application version and needs:
735735

736-
| Version \ Type | API + WEB | Only API |
737-
|:---:|:---|:---|
738-
| 8.x | `DragonCode\ApiResponse\Exceptions\Laravel\Eight\Handler as ExceptionHandler` | `DragonCode\ApiResponse\Exceptions\Laravel\Eight\ApiHandler as ExceptionHandler` |
739-
| 7.x | `DragonCode\ApiResponse\Exceptions\Laravel\Seven\Handler as ExceptionHandler` | `DragonCode\ApiResponse\Exceptions\Laravel\Seven\ApiHandler as ExceptionHandler` |
736+
| Version \ Type | API + WEB | Only API |
737+
|:--------------:|:------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
738+
| 9.x | `DragonCode\ApiResponse\Exceptions\Laravel\Nine\Handler as ExceptionHandler` | `DragonCode\ApiResponse\Exceptions\Laravel\Nine\ApiHandler as ExceptionHandler` |
739+
| 8.x | `DragonCode\ApiResponse\Exceptions\Laravel\Eight\Handler as ExceptionHandler` | `DragonCode\ApiResponse\Exceptions\Laravel\Eight\ApiHandler as ExceptionHandler` |
740+
| 7.x | `DragonCode\ApiResponse\Exceptions\Laravel\Seven\Handler as ExceptionHandler` | `DragonCode\ApiResponse\Exceptions\Laravel\Seven\ApiHandler as ExceptionHandler` |
740741

741742
If you did not add anything to this file, then delete everything properties and methods.
742743

@@ -747,7 +748,7 @@ For example, as a result, a clean file will look like this:
747748

748749
namespace App\Exceptions;
749750

750-
use DragonCode\ApiResponse\Exceptions\Laravel\Eight\Handler as ExceptionHandler;
751+
use DragonCode\ApiResponse\Exceptions\Laravel\Nine\Handler as ExceptionHandler;
751752

752753
class Handler extends ExceptionHandler
753754
{
@@ -762,8 +763,11 @@ More examples:
762763

763764
namespace App\Exceptions;
764765

766+
// use DragonCode\ApiResponse\Exceptions\Laravel\Nine\Handler as ExceptionHandler;
767+
use DragonCode\ApiResponse\Exceptions\Laravel\Nine\ApiHandler as ExceptionHandler;
768+
765769
// use DragonCode\ApiResponse\Exceptions\Laravel\Eight\Handler as ExceptionHandler;
766-
use DragonCode\ApiResponse\Exceptions\Laravel\Eight\ApiHandler as ExceptionHandler;
770+
// use DragonCode\ApiResponse\Exceptions\Laravel\Eight\ApiHandler as ExceptionHandler;
767771

768772
// use DragonCode\ApiResponse\Exceptions\Laravel\Seven\Handler as ExceptionHandler;
769773
// use DragonCode\ApiResponse\Exceptions\Laravel\Seven\ApiHandler as ExceptionHandler;
@@ -774,8 +778,6 @@ class Handler extends ExceptionHandler
774778
}
775779
```
776780

777-
Or you can change this file by adding code to it, similar to [ours](src/Support/LaravelException.php).
778-
779781
[[ to top ]](#api-response)
780782

781783

SECURITY.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

composer.json

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
{
22
"name": "dragon-code/api-response",
33
"description": "Package for standardizing the responses from the API of your Symfony based applications.",
4-
"type": "library",
54
"license": "MIT",
6-
"keywords": ["api response", "api-response", "response", "laravel", "lumen", "symfony", "api", "dragon-code", "dragon"],
5+
"type": "library",
6+
"keywords": [
7+
"api response",
8+
"api-response",
9+
"response",
10+
"laravel",
11+
"lumen",
12+
"symfony",
13+
"api",
14+
"dragon-code",
15+
"dragon"
16+
],
717
"authors": [
818
{
919
"name": "Andrey Helldar",
@@ -15,21 +25,20 @@
1525
"source": "https://github.com/TheDragonCode/api-response"
1626
},
1727
"require": {
18-
"php": "^7.2.5|^8.0",
28+
"php": "^7.2.5 || ^8.0",
1929
"ext-json": "*",
2030
"dragon-code/contracts": "^2.2",
2131
"dragon-code/support": "^5.0",
22-
"symfony/http-foundation": "^4.0|^5.0"
32+
"symfony/http-foundation": "^4.0 || ^5.0 || ^6.0"
2333
},
2434
"require-dev": {
25-
"orchestra/testbench": "^4.0|^5.0|^6.0"
35+
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0"
2636
},
2737
"conflict": {
2838
"andrey-helldar/api-response": "*"
2939
},
30-
"suggest": {
31-
"symfony/thanks": "Give thanks (in the form of a GitHub) to your fellow PHP package maintainers"
32-
},
40+
"minimum-stability": "stable",
41+
"prefer-stable": true,
3342
"autoload": {
3443
"psr-4": {
3544
"DragonCode\\ApiResponse\\": "src"
@@ -47,13 +56,15 @@
4756
"preferred-install": "dist",
4857
"sort-packages": true
4958
},
50-
"minimum-stability": "stable",
51-
"prefer-stable": true,
5259
"extra": {
5360
"thanks": [
5461
{
5562
"name": "dragon-code/support",
5663
"url": "https://github.com/TheDragonCode/support"
64+
},
65+
{
66+
"name": "dragon-code/contracts",
67+
"url": "https://github.com/TheDragonCode/contracts"
5768
}
5869
]
5970
}

0 commit comments

Comments
 (0)