- Add Laravel 10.0 support
- Add Fractal 0.20 support
- Add Laravel 9.0 support
- Add PHP 8.0 support
- Add Laravel 8.0 support
- Remove typehint from exception handler
- Add Laravel 7.0 support
- Add Laravel 6.0 support
- Add Laravel 5.8 support
- Add missing header call in
ConvertsExceptions
- Add Laravel 5.7 support
- Change Collection's
intersectKey
witharray_key_intersect
in transformer as the method isn't available in all Laravel versions
- When requesting non-whitelisted nested relations, it now returns any relation up to the one that's not whitelisted
- It will now automatically camel case relations before loading them from the model allowing for snake cased relations in transformers
- Fix bug concerning circular relationship mappings
- It will now correctly look for default relations in requested relations that are nested
Version 3.0.0
contains many bug fixes, but also quite a lot of new features and changes. The entire relationship logic has been rewritten to improve performance, security and stability among other improvements. There has also been big focus on improving test coverage for this release and we're now right below 90% coverage.
- Fractal requirement changed to
0.17.0
- Whitelisted relationships now requires a transformer mapping in order for eager loading to take effect
- Relationships will now only be eager loaded if you have specified a transformer with whitelisted relationships
- The
transform
method ofTransformer
service andTransformer
facade has been renamed tomake
and now returns aTransformBuilder
- The
Flugg\Responder\Transformer
service has been renamed toTransformation
- The
transform
helper function has been renamed totransformation
- The
Transformer
facade has been renamed toTransformation
NullSerializer
has been renamed toNoopSerializer
- New integration test suite
- Added support for primitive resources when including relations
- Added a
fallback_transformer
configuration option to change the fallback transformer - Added a
error_message_files
configuration option to change translation files to load error messages from - Support for specifying query constraints for relationships as "load" methods in transformers
- You no longer need to use the
resource
method inside "include" methods in transformers, you can just return the data directly
- It will now only eager load relationships that are whitelisted
- You can now call multiple transformers in sequence without problems
- Associative arrays will now be treated as an item rather than a collection
- A default resource key of
data
is now set, allowing to use theonly
method even when data is empty
- Added support for Laravel 5.6
- Removed extra end bracket in
PrettyPrintDecorator
- Added support for PHP 7.2
- Added two new optional decorators:
PrettyPrintDecorator
andEscapeHtmlDecorator
- New transformers now has an empty array as whitelisted relations instead of a wildcard
- Parameters are stripped away from relations before eager loading
- Changed
TransformFactory
from singleton to a normal binding NullSerializer
now returnsnull
instead of an empty array on null resources- Relations that have an "include" method in a transformer is no longer eager loaded
- Remove
string
typehint for$errorCode
- Change
Responder
andTransformer
from singletons to regular bindings
- Rebind incompatible translator implementation with Lumen
- Add JSON check to exception handler
- Fix a query string relation parsing bug
- Fix explode default value for query string relations
- Explode query string relations on comma to support multiple relations
- Automatic resolving of resource key if the data contains models
- Add missing
LogicException
import to baseTransformer
- Add missing
fields
key to error data ofValidationFailedException
- Change
Translator
contract with implementation to widen Laravel support
- Add missing
only
method toSuccessResponseBuilder
- Fix null data being converted to arrays for error responses
- Convert empty string messages in
HttpException
to null - Remove
data
field from error response to make it behave as stated in the documentation
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.
- Fractal requirement changed to
0.16.0
- Moved
Flugg\Responder\Transformer
toFlugg\Responder\Transformers\Transformer
- Changed
Flugg\Responder\Traits\RespondsWithJson
toFlugg\Responder\Http\Controllers\MakesResponses
- Changed
Flugg\Responder\Traits\HandlesApiErrors
toFlugg\Responder\Exceptions\ConvertsExceptions
- Moved
Flugg\Responder\Traits\MakesApiRequests
toFlugg\Responder\Testing\MakesApiRequests
- Removed
Flugg\Responder\Traits\ConvertsParameter
, use newConvertToSnakeCase
middleware instead - Removed
Flugg\Responder\Traits\ThrowsApiErrors
, manually override form requests to replicate - Changed
Flugg\Responder\Exceptions\Http\ApiException
toFlugg\Responder\Exceptions\Http\HttpException
- Renamed
$statusCode
property of theHttpException
exceptions to$status
- Removed
Flugg\Responder\Exceptions\Http\ResourceNotFoundException
, handler now points toPageNotFoundException
- Renamed
Flugg\Responder\Serializers\ApiSerializer
toFlugg\Responder\Serializers\SuccessSerializer
- Renamed
successResponse
method of theMakesResponses
trait tosuccess
- Renamed
errorResponse
method of theMakesResponses
trait toerror
- Return
SuccessResponseBuilder
fromsuccess
method instead ofJsonResponse
- Return
ErrorResponseBuilder
fromerror
method instead ofJsonResponse
- Renamed
include
method towith
onSuccessResponseBuilder
- Renamed
addMeta
method tometa
onSuccessResponseBuilder
- Removed
transform
method onSuccessResponseBuilder
, usesuccess
instead - Removed
getManager
andgetResource
methods fromSuccessResponseBuilder
- Changed
transformer
method of theTransformable
interface to non-static - Added an
include
prefix to include methods in transformers - Renamed
transformException
of exception handler trait toconvertDefaultException
- Renamed
renderApiError
of exception handler trait torenderResponse
- 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 toSuccessResponseBuilder
to replicate Fractal'sparseFieldsets
- Added a
cursor
method toSuccessResponseBuilder
for setting cursors - Added a
paginator
method toSuccessResponseBuilder
for setting paginators - Added a
without
method toSuccessResponseBuilder
to replicate Fractal'sparseExcludes
- 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 theConvertsExceptions
trait - Added a shortcut
-m
to the--model
modifier of themake:transformer
command - Added a
--plain
(and-p
) option tomake: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 the
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 baseTransformer
for creating related resources
- Remove extra field added from deeply nested relations (fixes #33)
- Relations are not eager loaded when automatically including relations (fixes #48)
- Add a new caching layer to transformers, increasing performance with deeply nested relations
- The relation inclusion code has been drastically improved