Skip to content

Commit 75c8fd1

Browse files
Merge pull request #204 from MarcinOrlowski/dev
Release v9.3.0
2 parents 024eccf + 3752f67 commit 75c8fd1

File tree

97 files changed

+1780
-914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1780
-914
lines changed

.config/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
![REST API Response Builder for Laravel](../docs/img/logo.png)
2+
3+
# REST API Response Builder for Laravel #
4+
5+
`ResponseBuilder` is a helper library for [Laravel](https://laravel.com/) framework,
6+
designed to help you build nice, normalized and easy to consume JSON response structures
7+
for your REST API.
8+
9+
## Test dependencies ##
10+
11+
Development dependencies are no longer part of default `composer.json` as they differ
12+
depending on target platform and Laravel versions. All dedicated text files sit
13+
in `.config/` folder. To install dependencies based on that file use:
14+
15+
```bash
16+
$ COMPOSER=.config/composer-laravel-8.x.json composer install
17+
```
18+
19+
then you can run all the tests as usual.

.config/composer-laravel-6.x.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "marcin-orlowski/laravel-api-response-builder",
3+
"autoload": {
4+
"psr-4": {
5+
"MarcinOrlowski\\ResponseBuilder\\": "src/",
6+
"MarcinOrlowski\\ResponseBuilder\\Tests\\Traits\\": "tests/Traits/",
7+
"MarcinOrlowski\\ResponseBuilder\\Tests\\": "tests/phpunit"
8+
}
9+
},
10+
"require": {
11+
"php": "^7.2 | ^7.3 | ^8.0",
12+
"laravel/framework": "^6.8"
13+
},
14+
"require-dev": {
15+
"marcin-orlowski/phpunit-extra-asserts": "^1.2",
16+
"orchestra/testbench": "^4.0",
17+
"phpunit/phpunit": "^8.0",
18+
"phpunit/php-code-coverage": "^7.0"
19+
}
20+
}

.config/composer-laravel-7.x.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "marcin-orlowski/laravel-api-response-builder",
3+
"autoload": {
4+
"psr-4": {
5+
"MarcinOrlowski\\ResponseBuilder\\": "src/",
6+
"MarcinOrlowski\\ResponseBuilder\\Tests\\Traits\\": "tests/Traits/",
7+
"MarcinOrlowski\\ResponseBuilder\\Tests\\": "tests/phpunit"
8+
}
9+
},
10+
"require": {
11+
"php": "^7.2 | ^8.0",
12+
"laravel/framework": "^7.0"
13+
},
14+
"require-dev": {
15+
"marcin-orlowski/phpunit-extra-asserts": "^1.2",
16+
"orchestra/testbench": "^5.0",
17+
"phpunit/phpunit": "^8.0",
18+
"phpunit/php-code-coverage": "^7.0"
19+
}
20+
}

.config/composer-laravel-8.x.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "marcin-orlowski/laravel-api-response-builder",
3+
"autoload": {
4+
"psr-4": {
5+
"MarcinOrlowski\\ResponseBuilder\\": "src/",
6+
"MarcinOrlowski\\ResponseBuilder\\Tests\\Traits\\": "tests/Traits/",
7+
"MarcinOrlowski\\ResponseBuilder\\Tests\\": "tests/phpunit"
8+
}
9+
},
10+
"require": {
11+
"php": "^7.3 | ^8.0",
12+
"laravel/framework": "^8.0"
13+
},
14+
"require-dev": {
15+
"marcin-orlowski/coding-standard": "^1.3",
16+
"marcin-orlowski/phpunit-extra-asserts": "^1.2",
17+
"orchestra/testbench": "^6.0",
18+
"phpunit/phpunit": "^8.0",
19+
"phpunit/php-code-coverage": "^7.0",
20+
"nunomaduro/larastan": "^0.7.6"
21+
}
22+
}

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
### Checklist:
88

99
* [ ] I have opened the issue ticket that this pull request is part of.
10-
* [ ] This pull request title contains `(#TICKET-NUMBER)` for reference..
10+
* [ ] This pull request title contains `(#TICKET-NUMBER)` for reference.
1111
* [ ] This pull request description contains `Closes #{$ISSUE_NO}` that closes ticket.
1212
* [ ] This pull request is all my own work - I have not plagiarized.
1313
* [ ] This contribution is licensed under MIT or compatible license.

.github/workflows/coverage.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
##################################################################################
2+
#
3+
# Laravel API Response Builder Unit tests Github Action config
4+
#
5+
# @package MarcinOrlowski\ResponseBuilder
6+
#
7+
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
8+
# @copyright 2016-2021 Marcin Orlowski
9+
# @license http://www.opensource.org/licenses/mit-license.php MIT
10+
# @link https://github.com/MarcinOrlowski/laravel-api-response-builder
11+
#
12+
##################################################################################
13+
14+
name: "Coverage"
15+
16+
on:
17+
push:
18+
branches:
19+
- "master"
20+
pull_request:
21+
branches:
22+
- "master"
23+
- "dev"
24+
25+
jobs:
26+
build:
27+
strategy:
28+
# do not stop the workflow if single run failed
29+
fail-fast: false
30+
matrix:
31+
# quotes are needed it is treated as a number and zero at decimal part is gone at runtime
32+
laravel: ["8.x"]
33+
php: ["8.0"]
34+
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: "Checkout repository..."
39+
uses: actions/checkout@v2
40+
41+
- name: "Setup proper composer.json"
42+
run: cp -f ".config/composer-laravel-${{ matrix.laravel }}.json" composer.json
43+
44+
# https://github.com/marketplace/actions/composer-php-actions
45+
- name: "Installing dependencies..."
46+
uses: php-actions/composer@v6
47+
with:
48+
version: 2
49+
php_version: "${{ matrix.php }}"
50+
dev: yes
51+
52+
# https://github.com/marketplace/actions/phpunit-php-actions
53+
- name: "Running PHPUnit with Coverage..."
54+
uses: php-actions/phpunit@v3
55+
with:
56+
bootstrap: "vendor/autoload.php"
57+
configuration: "tests/phpunit.xml"
58+
php_extensions: "xdebug"
59+
args: --coverage-clover coverage.xml
60+
env:
61+
XDEBUG_MODE: coverage
62+
63+
# https://github.com/marketplace/actions/codecov
64+
- name: "Uploading coverage to CodeCov.io..."
65+
uses: codecov/codecov-action@v1
66+
with:
67+
files: coverage.xml
68+
flags: unittests
69+
fail_ci_if_error: true

.github/workflows/phpstan.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
1+
##################################################################################
12
#
2-
# Laravel API Response Builder
3+
# Laravel API Response Builder Static code analysis Github Action config
34
#
45
# @package MarcinOrlowski\ResponseBuilder
56
#
67
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
78
# @copyright 2016-2021 Marcin Orlowski
89
# @license http://www.opensource.org/licenses/mit-license.php MIT
910
# @link https://github.com/MarcinOrlowski/laravel-api-response-builder
11+
#
12+
##################################################################################
1013

11-
name: phpstan
14+
name: "Static Analysis"
1215

13-
on: [push]
16+
on:
17+
push:
18+
branches:
19+
- "master"
20+
pull_request:
21+
branches:
22+
- "master"
23+
- "dev"
1424

1525
jobs:
1626
build:
1727
strategy:
28+
# do not stop the workflow if single run failed
1829
fail-fast: false
1930
matrix:
20-
php: [7.4, 8.0]
31+
# quotes are needed it is treated as a number and zero at decimal part is gone at runtime
32+
laravel: ["8.x"]
33+
php: ["7.4", "8.0"]
2134

2235
runs-on: ubuntu-latest
2336

2437
steps:
25-
- name: Checkout repository...
38+
- name: "Checkout repository..."
2639
uses: actions/checkout@v2
2740

28-
- name: Installing dependencies...
41+
- name: "Setup proper composer.json"
42+
run: cp -f ".config/composer-laravel-${{ matrix.laravel }}.json" composer.json
43+
44+
# https://github.com/marketplace/actions/composer-php-actions
45+
- name: "Installing dependencies..."
2946
uses: php-actions/composer@v6
3047
with:
3148
version: 2
32-
php_version: ${{ matrix.php }}
49+
php_version: "${{ matrix.php }}"
3350
dev: yes
3451

35-
- name: Running PHPStan...
52+
- name: "Running PHPStan..."
3653
uses: php-actions/phpstan@v3
3754
with:
38-
configuration: phpstan.neon
39-
php_version: ${{ matrix.php }}
55+
configuration: "phpstan.neon"
56+
php_version: "${{ matrix.php }}"
4057
memory_limit: 16M

.github/workflows/phpunit.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
1+
##################################################################################
12
#
2-
# Laravel API Response Builder
3+
# Laravel API Response Builder Unit tests Github Action config
34
#
45
# @package MarcinOrlowski\ResponseBuilder
56
#
67
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
78
# @copyright 2016-2021 Marcin Orlowski
89
# @license http://www.opensource.org/licenses/mit-license.php MIT
910
# @link https://github.com/MarcinOrlowski/laravel-api-response-builder
11+
#
12+
##################################################################################
1013

11-
name: phpunit
14+
name: "Unit Tests"
1215

13-
on: [push]
16+
on:
17+
push:
18+
branches:
19+
- "master"
20+
pull_request:
21+
branches:
22+
- "master"
23+
- "dev"
1424

1525
jobs:
1626
build:
1727
strategy:
1828
# do not stop the workflow if single run failed
1929
fail-fast: false
2030
matrix:
21-
laravel: [6.0, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 8.0]
22-
php: [7.2, 7.3, 7.4, 8.0]
31+
# quotes are needed it is treated as a number and zero at decimal part is gone at runtime
32+
laravel: ["6.x", "7.x", "8.x"]
33+
php: ["7.2", "7.3", "7.4", "8.0"]
2334
exclude:
2435
# Laravel 8.x requires PHP 7.3+
25-
- laravel: 8.0
26-
php: 7.2
36+
- laravel: "8.x"
37+
php: "7.2"
2738

2839
runs-on: ubuntu-latest
2940

3041
steps:
31-
- name: Checkout repository...
42+
- name: "Checkout repository..."
3243
uses: actions/checkout@v2
3344

34-
- name: Installing dependencies...
45+
- name: "Setup proper composer.json"
46+
run: cp -f ".config/composer-laravel-${{ matrix.laravel }}.json" composer.json
47+
48+
# https://github.com/marketplace/actions/composer-php-actions
49+
- name: "Installing dependencies..."
3550
uses: php-actions/composer@v6
3651
with:
3752
version: 2
38-
php_version: ${{ matrix.php }}
53+
php_version: "${{ matrix.php }}"
3954
dev: yes
4055

41-
- name: Running unit tests...
56+
# https://github.com/marketplace/actions/phpunit-php-actions
57+
- name: "Running PHPUnit..."
4258
uses: php-actions/phpunit@v3
4359
with:
44-
bootstrap: vendor/autoload.php
45-
configuration: tests/phpunit.xml
60+
bootstrap: "vendor/autoload.php"
61+
configuration: "tests/phpunit.xml"
62+

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.idea/
22
vendor/
3-
composer.lock
4-
.*.cache
3+
*.lock
4+
*.cache
55
*.swp
66
*~
77
*.bak

.travis.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# @package MarcinOrlowski\ResponseBuilder
66
#
77
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
8-
# @copyright 2016-2020 Marcin Orlowski
8+
# @copyright 2016-2021 Marcin Orlowski
99
# @license http://www.opensource.org/licenses/mit-license.php MIT
1010
# @link https://github.com/MarcinOrlowski/laravel-api-response-builder
1111
#
@@ -20,16 +20,9 @@ php:
2020
- 8.0
2121

2222
env:
23-
- LARAVEL_VERSION="6.0"
24-
- LARAVEL_VERSION="6.2"
25-
- LARAVEL_VERSION="6.3"
26-
- LARAVEL_VERSION="6.4"
27-
- LARAVEL_VERSION="6.5"
28-
- LARAVEL_VERSION="6.6"
29-
- LARAVEL_VERSION="6.7"
30-
- LARAVEL_VERSION="6.8"
31-
- LARAVEL_VERSION="7.0"
32-
- LARAVEL_VERSION="8.0"
23+
- LARAVEL_VERSION="6.x"
24+
- LARAVEL_VERSION="7.x"
25+
- LARAVEL_VERSION="8.x"
3326

3427
matrix:
3528
exclude:
@@ -41,7 +34,7 @@ cache:
4134
- ${HOME}/.composer/cache/files
4235

4336
before_script:
44-
- cp -f "travis/composer-laravel-${LARAVEL_VERSION}.json" composer.json
37+
- cp -f ".config/composer-laravel-${LARAVEL_VERSION}.json" composer.json
4538
- composer install --prefer-dist
4639
# Need to tweak signature of setUp() and tearDown() methods and strip the ": void" from it, otherwise tests
4740
# run will fail due to signature mismatch. This affects Laravel 5.8+ and 6.x as they pull recent Orchestra

0 commit comments

Comments
 (0)