Download the PHP package dotkernel/dot-errorhandler without Composer
On this page you can find all versions of the php package dotkernel/dot-errorhandler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dotkernel/dot-errorhandler
More information about dotkernel/dot-errorhandler
Files in dotkernel/dot-errorhandler
Package dot-errorhandler
Short Description Logging Error Handler for Middleware Applications
License MIT
Homepage https://github.com/dotkernel/dot-errorhandler
Informations about the package dot-errorhandler
dot-errorhandler
Error Logging Handler for DotKernel
Adding the error handler
- Add the composer package:
composer require dotkernel/dot-errorhandler
-
Add the config provider
- in
config/config.php
add\Dot\ErrorHandler\ConfigProvider
- in
config/pipeline.php
add\Dot\ErrorHandler\ErrorHandlerInterface::class
- the interface is used as an alias to keep all error handling related configurations in one file
- IMPORTANT NOTE there should be no other error handlers after this one (only before) because the other error handler will catch the error causing dot-errorhandler not to catch any error, we recommend using just one error handler unless you have an error-specific handler
- in
- Configure the error handler as shown below
config/autoload/error-handling.global.php
A configuration example for the default logger can be found in config/log.global.php.dist
.
When declaring the ErrorHandlerInterface
alias you can choose whether to log or not:
- for logging use
LogErrorHandler
- for the simple Zend Expressive handler user
ErrorHandler
The class Dot\ErrorHandler\ErrorHandler
is the same as the Zend Expressive error handling class
the only difference being the removal of the final
statement for making extension possible.
The class Dot\ErrorHandler\LogErrorHandler
is Dot\ErrorHandler\ErrorHandler
with
added logging support.
As a note: both LogErrorHandler
and ErrorHandler
have factories declared in the
package's ConfigProvider
. If you need a custom ErrorHandler it must have a factory
declared in the config, as in the example.
Example:
Config examples can be found in this project's config
directory.
All versions of dot-errorhandler with dependencies
dotkernel/dot-log Version ^4.0.2
laminas/laminas-diactoros Version ^3.3
laminas/laminas-stratigility Version ^3.11
mezzio/mezzio Version ^3.19
psr/http-message Version ^1.0 || ^2.0
psr/http-server-middleware Version ^1.0