-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving to Github Action and removing support for old php versions (#54)
- Loading branch information
1 parent
41aeb78
commit c45d21a
Showing
25 changed files
with
283 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Api Response Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-20.04] | ||
php: [7.4, 8.0, 8.1] | ||
|
||
name: PHP ${{ matrix.php }} on ${{ matrix.os }} | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: phpunit | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v2 | ||
|
||
- name: Run Tests | ||
run: composer test -- --coverage-text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
on: [ pull_request ] | ||
name: Static analysis | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: apcu, redis | ||
coverage: none | ||
tools: phpstan:1.4.10 | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: PHPStan | ||
run: phpstan analyze | ||
|
||
psalm: | ||
name: Psalm | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
extensions: apcu, redis | ||
coverage: none | ||
tools: vimeo/psalm:4.22.0 | ||
|
||
- name: Download dependencies | ||
uses: ramsey/composer-install@v1 | ||
|
||
- name: Psalm | ||
run: psalm --no-progress --output-format=github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Api Response Style Checks | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
style: | ||
runs-on: ubuntu-latest | ||
name: Api Response Style Checks | ||
steps: | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
|
||
- name: Cache Dependencies | ||
id: composer-cache-style | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ubuntu-composer-cache-style-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ubuntu-php-style | ||
|
||
- name: Install Dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Check Coding Style | ||
run: vendor/bin/phpcs src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
build | ||
vendor | ||
composer.lock | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,8 @@ | |
|
||
[![Latest Version](https://img.shields.io/github/release/ellipsesynergie/api-response.svg?style=flat-square)](https://github.com/ellipsesynergie/api-response/releases) | ||
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) | ||
[![Build Status](https://img.shields.io/travis/ellipsesynergie/api-response.svg?style=flat-square)](https://travis-ci.org/ellipsesynergie/api-response) | ||
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/ellipsesynergie/api-response.svg?style=flat-square)](https://scrutinizer-ci.com/g/ellipsesynergie/api-response/code-structure) | ||
[![Quality Score](https://img.shields.io/scrutinizer/g/ellipsesynergie/api-response.svg?style=flat-square)](https://scrutinizer-ci.com/g/ellipsesynergie/api-response) | ||
![Api Response Tests](https://github.com/ellipsesynergie/api-response/actions/workflows/run-test.yml/badge.svg) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/ellipsesynergie/api-response.svg?style=flat-square)](https://packagist.org/packages/ellipsesynergie/api-response) | ||
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/4d91348d-221b-4ee8-97cc-3e26383092c5/mini.png)](https://insight.sensiolabs.com/projects/4d91348d-221b-4ee8-97cc-3e26383092c5) | ||
|
||
Simple package to handle response properly in your API. This package uses [Fractal](https://github.com/thephpleague/fractal) | ||
and is based on [Build APIs You Won't Hate](https://leanpub.com/build-apis-you-wont-hate) book. | ||
|
@@ -21,34 +18,18 @@ $ composer require ellipsesynergie/api-response | |
|
||
## Requirements | ||
|
||
The following versions of PHP are supported by this version. | ||
The following versions of PHP are supported by this version: | ||
|
||
* PHP 5.6 | ||
* PHP 7.0 | ||
* PHP 7.1 | ||
* PHP 7.2 | ||
>= PHP 7.4 | ||
|
||
### Install in Laravel 4 | ||
|
||
Unfortunately, since the release 0.9.0, Laravel 4 is no longer supported because `league/[email protected]` no longer support this version. | ||
However, you can use the version `0.8.*` if you need to use it inside Laravel 4. | ||
|
||
### Install in Laravel 5 | ||
### Install in Laravel | ||
Add this following service provider to your `config/app.php` file. | ||
|
||
```php | ||
EllipseSynergie\ApiResponse\Laravel\ResponseServiceProvider::class | ||
``` | ||
|
||
### Install in Lumen 5 | ||
|
||
Register this service provider to your `bootstrap/app.php` file. | ||
|
||
```php | ||
$app->register('EllipseSynergie\ApiResponse\Laravel\LumenServiceProvider'); | ||
``` | ||
|
||
### Install in Lumen 5.4+ | ||
### Install in Lumen | ||
|
||
Because of the request object change ([see reference](https://laravel-news.com/request-object-changes-in-lumen-5-4)) you can no longer access `Request` object properly in Service provider. To be convenient, we have created a middleware to be used for parsing the `include` parameter. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PSR12"> | ||
<description>PSR12</description> | ||
<rule ref="PSR12"> | ||
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing"/> | ||
</rule> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="150"/> | ||
<property name="absoluteLineLimit" value="0"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Function response not found\\.$#" | ||
count: 1 | ||
path: src/Laravel/Response.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$message of method EllipseSynergie\\\\ApiResponse\\\\AbstractResponse\\:\\:errorWrongArgs\\(\\) expects string, array given\\.$#" | ||
count: 1 | ||
path: src/Laravel/Response.php | ||
|
||
- | ||
message: "#^Call to static method macro\\(\\) on an unknown class Response\\.$#" | ||
count: 1 | ||
path: src/Laravel/ResponseServiceProvider.php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
includes: | ||
- ./phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 5 | ||
reportUnmatchedIgnoredErrors: false | ||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703"> | ||
<file src="src/Laravel/LumenServiceProvider.php"> | ||
<UndefinedInterfaceMethod occurrences="1"> | ||
<code>$this->app</code> | ||
</UndefinedInterfaceMethod> | ||
</file> | ||
<file src="src/Laravel/Response.php"> | ||
<InvalidArgument occurrences="1"> | ||
<code>$validator->getMessageBag()->toArray()</code> | ||
</InvalidArgument> | ||
<UndefinedFunction occurrences="1"> | ||
<code>response()</code> | ||
</UndefinedFunction> | ||
</file> | ||
<file src="src/Laravel/ResponseServiceProvider.php"> | ||
<UndefinedClass occurrences="1"> | ||
<code>\Response</code> | ||
</UndefinedClass> | ||
<UndefinedInterfaceMethod occurrences="1"> | ||
<code>$this->app</code> | ||
</UndefinedInterfaceMethod> | ||
</file> | ||
</files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="5" | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
errorBaseline="psalm.baseline.xml" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
Oops, something went wrong.