Download the PHP package middlewares/json-exception-handler without Composer
On this page you can find all versions of the php package middlewares/json-exception-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/json-exception-handler
More information about middlewares/json-exception-handler
Files in middlewares/json-exception-handler
Package json-exception-handler
Short Description Middleware to catch exceptions and output them as JSON
License MIT
Homepage https://github.com/middlewares/json-exception-handler
Informations about the package json-exception-handler
middlewares/json-exception-handler
Catches exceptions that occur during request handling and output them as JSON.
Requirements
- PHP >= 7.2
- A PSR-7 http message implementation (Diactoros, Guzzle, Slim, etc...)
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/json-exception-handler.
JsonExceptionHandler
Catches exceptions thrown that occur later in request processing an creates a new response with HTTP 500 status and JSON encoded version of the exception as the body.
contentType(string $type)
Change the Content-Type header of the response. Default is application/json.
includeTrace(bool $enable)
Enable or disable the stack trace in the response. Default is true.
jsonOptions(int $options)
Set options for json_encode of the exception. Default is 0.
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of json-exception-handler with dependencies
middlewares/utils Version ^2 || ^3 || ^4
psr/http-server-middleware Version ^1
wyrihaximus/json-throwable Version ^2 || ^3 || ^4
thecodingmachine/safe Version ^1 || ^2 || ^3