-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
115 changed files
with
6,823 additions
and
4,847 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 |
---|---|---|
@@ -1,10 +1,2 @@ | ||
/.idea | ||
/vendor | ||
composer.lock | ||
.DS_STORE | ||
.*.swo | ||
.*.swp | ||
.swo | ||
.swp | ||
*.sublime-project | ||
*.sublime-workspace | ||
composer.lock |
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# Travis CI configuration | ||
language: php | ||
php: | ||
- '7.0' | ||
- 7.0 | ||
- 7.1 | ||
before_script: | ||
- composer self-update | ||
- composer install --prefer-source --no-interaction | ||
- composer dump-autoload | ||
|
||
script: | ||
- vendor/bin/phpunit |
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,73 @@ | ||
# 2.0.0 (2017-08-01) | ||
|
||
Version `2.0.0` has been a complete rewrite of the package and brings a lot new stuff to the table, including this very new changelog. The documentation has also been revamped and explains all the new features in greater details. If you're upgrading from an earlier version, make sure to remove your `config/responder.php` file and rerun `php artisan vendor:publish --provider="Flugg\Responder\ResponderServiceProvider"` to publish the new configuration file. | ||
|
||
### Breaking Changes | ||
|
||
* Fractal requirement changed to `0.16.0` | ||
* Moved `Flugg\Responder\Transformer` to `Flugg\Responder\Transformers\Transformer` | ||
* Changed `Flugg\Responder\Traits\RespondsWithJson` to `Flugg\Responder\Http\Controllers\MakesResponses` | ||
* Changed `Flugg\Responder\Traits\HandlesApiErrors` to `Flugg\Responder\Exceptions\ConvertsExceptions` | ||
* Moved `Flugg\Responder\Traits\MakesApiRequests` to `Flugg\Responder\Testing\MakesApiRequests` | ||
* Removed `Flugg\Responder\Traits\ConvertsParameter`, use new `ConvertToSnakeCase` middleware instead | ||
* Removed `Flugg\Responder\Traits\ThrowsApiErrors`, manually override form requests to replicate | ||
* Changed `Flugg\Responder\Exceptions\Http\ApiException` to `Flugg\Responder\Exceptions\Http\HttpException` | ||
* Renamed `$statusCode` property of the `HttpException` exceptions to `$status` | ||
* Removed `Flugg\Responder\Exceptions\Http\ResourceNotFoundException`, handler now points to `PageNotFoundException` | ||
* Renamed `Flugg\Responder\Serializers\ApiSerializer` to `Flugg\Responder\Serializers\SuccessSerializer` | ||
* Renamed `successResponse` method of the `MakesResponses` trait to `success` | ||
* Renamed `errorResponse` method of the `MakesResponses` trait to `error` | ||
* Return `SuccessResponseBuilder` from `success` method instead of `JsonResponse` | ||
* Return `ErrorResponseBuilder` from `error` method instead of `JsonResponse` | ||
* Renamed `include` method to `with` on `SuccessResponseBuilder` | ||
* Renamed `addMeta` method to `meta` on `SuccessResponseBuilder` | ||
* Removed `transform` method on `SuccessResponseBuilder`, use `success` instead | ||
* Removed `getManager` and `getResource` methods from `SuccessResponseBuilder` | ||
* Changed `transformer` method of the `Transformable` interface to non-static | ||
* Added an `include` prefix to include methods in transformers | ||
* Renamed `transformException` of exception handler trait to `convertDefaultException` | ||
* Renamed `renderApiError` of exception handler trait to `renderResponse` | ||
|
||
### Features | ||
|
||
* Added configurable response decorators | ||
* Added a `recursion_limit` configuration option | ||
* Allow transforming raw arrays and collections | ||
* Allow sending transformers to the `success` method | ||
* Allow sending resources as data to the `success` method | ||
* Added a `only` method to `SuccessResponseBuilder` to replicate Fractal's `parseFieldsets` | ||
* Added a `cursor` method to `SuccessResponseBuilder` for setting cursors | ||
* Added a `paginator` method to `SuccessResponseBuilder` for setting paginators | ||
* Added a `without` method to `SuccessResponseBuilder` to replicate Fractal's `parseExcludes` | ||
* Relationships are now automatically eager loaded | ||
* Changed `with` method to allow eager loading closures | ||
* Added a `filter_fields_parameter` configuration option for automatic data filtering | ||
* Added a `PageNotFoundException` exception | ||
* Added a `page_not_found` default error code | ||
* Added a `ConvertToSnakeCase` middleware to convert request parameters to snake case | ||
* Added a `Flugg\Responder\Transformer` service to transform without serializing | ||
* Added a `Transformer` facade to transform without serializing | ||
* Added a `transform` helper method to transform without serializing | ||
* Added a `NullSerializer` serializer to serialize without modifying the data | ||
* Added an `ErrorSerializer` contract for serializing errors | ||
* Added a default `Flugg\Responder\Serializers\ErrorSerializer` | ||
* Added a `$load` property to transformers to replicate Fractal's `$defaultIncludes` | ||
* Added a dynamic method in transformers to filter relations: `filterRelationName` | ||
* Allow converting custom exceptions using the `convert` method of the `ConvertsExceptions` trait | ||
* Added a shortcut `-m` to the `--model` modifier of the `make:transformer` command | ||
* Added a `--plain` (and `-p`) option to `make:transformer` to make plain transformers | ||
* Added possibility to bind transformers to models using the `TransformerResolver` class | ||
* Added possibility to bind error messages to error codes using tne `ErrorMessageResolver` class | ||
* Decoupled Fractal from the package by introducing a `TransformFactory` adapter | ||
* Changed `success` to transform using an item resource if passed a has-one relation | ||
* Added a `resource` method to the base `Transformer` for creating related resources | ||
|
||
### Bug Fixes | ||
|
||
* Remove extra field added from deeply nested relations (fixes #33) | ||
* Relations are not eager loaded when automatically including relations (fixes #48) | ||
|
||
### Performance Improvements | ||
|
||
* Add a new caching layer to transformers, increasing performance with deeply nested relations | ||
* The relation inclusion code has been drastically improved |
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,76 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Serializer Class Paths | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The full class path to the serializer classes you want to use for both | ||
| success- and error responses. The success serializer must implement | ||
| Fractal's serializer. You can override these for every response. | ||
| | ||
*/ | ||
|
||
'serializers' => [ | ||
'success' => Flugg\Responder\Serializers\SuccessSerializer::class, | ||
'error' => \Flugg\Responder\Serializers\ErrorSerializer::class, | ||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Response Decorators | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Response decorators are used to decorate both your success- and error | ||
| responses. A decorator can be disabled by removing it from the list | ||
| below. You may additionally add your own decorators to the list. | ||
| | ||
*/ | ||
|
||
'decorators' => [ | ||
\Flugg\Responder\Http\Responses\Decorators\StatusCodeDecorator::class, | ||
\Flugg\Responder\Http\Responses\Decorators\SuccessFlagDecorator::class, | ||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Autoload Relationships With Query String | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The package can automatically load relationships from the query string | ||
| and will look for a query string parameter with the name configured | ||
| below. You can set the value to null to disable the autoloading. | ||
| | ||
*/ | ||
|
||
'load_relations_parameter' => 'with', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Filter Fields With Query String | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The package can automatically filter the fields of transformed data | ||
| from a query string parameter configured below. The technique is | ||
| also known as sparse fieldsets. Set it to null to disable it. | ||
| | ||
*/ | ||
|
||
'filter_fields_parameter' => 'only', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Recursion Limit | ||
|-------------------------------------------------------------------------- | ||
| | ||
| When transforming data, you may be including relations recursively. | ||
| By setting the value below, you can limit the amount of times it | ||
| should include relationships recursively. Five might be good. | ||
| | ||
*/ | ||
|
||
'recursion_limit' => 5, | ||
|
||
]; |
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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Laravel Responder Test Suite"> | ||
<directory>./tests/</directory> | ||
<testsuite name="Unit"> | ||
<directory>./tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="Feature"> | ||
<directory>./tests/Feature</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
Oops, something went wrong.