pixelfusion/api-serializer

This package is abandoned and no longer maintained. No replacement package was suggested.

Custom Fractal serializer for our preferred API output.

1.1.2 2017-05-21 23:02 UTC

This package is not auto-updated.

Last update: 2019-09-09 22:48:04 UTC


README

NZ Love Awesomeness

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
  }
}