Package Data | |
---|---|
Maintainer Username: | matthew.erskine |
Maintainer Contact: | matthew@erskine.com (Matthew Erskine) |
Package Create Date: | 2018-05-25 |
Package Last Update: | 2018-05-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 15:03:10 |
Package Statistics | |
---|---|
Total Downloads: | 481 |
Monthly Downloads: | 13 |
Daily Downloads: | 1 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This is a simple package which provides a static helper class for generating errors suitable to quickly render as JSON.
To use in Laravel/Lumen applications:
in app/Exceptions/Handler.php
:
use MatthewErskine\JsonErrorRenderer\JsonErrorRenderer;
public function render($request, Exception $e)
{
$error = JsonErrorRenderer::render($request, $e);
return response()->json(
$error->getPayload(),
$error->getStatusCode()
);
}