laravel-json-api-exceptions maintained by floor9design
Laravel JSON:API Exceptions
Easily render Laravel API exceptions as consistent JSON:API error responses.
Introduction
The JSON API has a precise response format. This set of classes allows these to be easily created and interrogated, meaning easy and reliable output/input processing.
The floor9design-ltd/json-api-formatter package offers a great way to automatically format these, easing the process
significantly.
However, in real life development generic or system errors can be an afterthought and sometimes left out. This package offers a well-rounded boilerplate for the Laravel framework, so that these are taken care of in a few minutes.
It gives a shared exception renderer.
Features
- Simple setup in Laravel
- Easy use; simply throw an exception inside your Laravel logic and this will be caught and displayed professionally
- Consistent JSON:API responses.
- Standard responses for authentication, authorisation, validation and resource lookup failures.
- Wide range of errors recognised
Requirements
The renderer uses JSON:API Formatter to build error documents.
Documentation
- Installation covers setup.
- Extending covers how to modify or add your own exceptions.
Project status
This README describes the planned first release. The package and linked guides are in development.
Credits
As always - a github watch/star and a follow is appreciated!