Download the PHP package middlewares/error-handler without Composer
On this page you can find all versions of the php package middlewares/error-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/error-handler
More information about middlewares/error-handler
Files in middlewares/error-handler
Package error-handler
Short Description Middleware to handle http errors
License MIT
Homepage https://github.com/middlewares/error-handler
Informations about the package error-handler
middlewares/error-handler
Middleware to catch and format errors encountered while handling the request.
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/error-handler.
Example
Usage
Add the formatters to be used (instances of Middlewares\ErrorFormatter\FormatterInterface
). If no formatters are provided, use all available.
Note: If no formatter is found, the first value of the array will be used. In the example above, HtmlFormatter
.
How to log the error and delegate and delegate the formatting to the middleware
Please note that the following snippet must go even before error-hander's middleware.
How to use a custom response for Production
This snippet might come handy when you want to customize your response in production.
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of error-handler with dependencies
middlewares/utils Version ^2 || ^3 || ^4
psr/http-server-middleware Version ^1
ext-gd Version *