pixelfusion / api-serializer
Custom Fractal serializer for our preferred API output.
Installs: 3 791
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- league/fractal: >=0.13.0, <0.20
This package is not auto-updated.
Last update: 2019-09-09 22:48:04 UTC
README
This package provides a custom Serializer for Fractal that transforms data into the API output that we at Pixel Fusion prefer.
Installation
To install the latest version of this package run the following command:
composer require pixelfusion/api-serializer
After that you should change the serializer that you want to use to PixelFusion\Fractal\Serializer\ApiSerializer
.
Output format
This API serializer extends the default ArraySerializer but has a slight difference. For the pagination we omitted the fields that we don't use. Below is an example of how a response that includes pagination will look like:
{ "data": [ { "id": "7ywpxp6r", "title": "The Godfather", }, { "id": "q9pykp17", "title": "Pulp Fiction", } ], "pagination": { "total": 9, "per_page": 2, "current_page": 1, "last_page": 5 } }