faecie/json-api-error-response

The Bundle provides en error response as it described in JsonApi specification

0.1.4 2018-11-15 08:00 UTC

This package is auto-updated.

Last update: 2024-11-04 18:56:30 UTC


README

Scrutinizer Code Quality Code Coverage Build Status License

This bundle provides a way return JSON:API compatible error responses from REST endponts

Perfectly works along with FOS REST bundle configured to json response. OIn this case you will alway get response in a JSONAPI compatible format. https://jsonapi.org/format/#errors

Installation

$ composer require faecie/json-api-error-response ^0.1

Configuration

You can configure the response of your exception in different ways:

  1. Implement interface DescriptiveExceptionInterface on your exception with only one method returning the array of Error objects
  2. Configure each exception class in the bandle configuration
  3. Tag you service as json_api.exception_describer and implement ExceptionDescriberInterface on it with only one method allowing you to control how to serialize your exceptions