PHPackages                             dotkernel/dot-errorhandler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. dotkernel/dot-errorhandler

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

dotkernel/dot-errorhandler
==========================

Logging Error Handler for Middleware Applications

4.4.2(6mo ago)543.3k↓79.6%2[3 issues](https://github.com/dotkernel/dot-errorhandler/issues)4MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Nov 19Pushed 6mo ago4 watchersCompare

[ Source](https://github.com/dotkernel/dot-errorhandler)[ Packagist](https://packagist.org/packages/dotkernel/dot-errorhandler)[ Docs](https://github.com/dotkernel/dot-errorhandler)[ RSS](/packages/dotkernel-dot-errorhandler/feed)WikiDiscussions 4.1 Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (37)Used By (4)

dot-errorhandler
================

[](#dot-errorhandler)

dot-errorhandler is Dotkernel's PSR-15 compliant error handler.

Version History
---------------

[](#version-history)

BranchReleasePSR-11Log Style ImplementationOSS LifecyclePHP Version4.1`>= 4.2`2PSR-Log[![OSS Lifecycle](https://camo.githubusercontent.com/f5c00e7baad446b2e8914d194f223657cebf87ecbc39d74ae8f41508f605c460/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e312532464f53534d45544144415441)](https://camo.githubusercontent.com/f5c00e7baad446b2e8914d194f223657cebf87ecbc39d74ae8f41508f605c460/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e312532464f53534d45544144415441)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/e5b81f34a7604ec04c27b3f84d470c0d50ab014a559051942ff958f2f1c17647/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e342e31)](https://camo.githubusercontent.com/e5b81f34a7604ec04c27b3f84d470c0d50ab014a559051942ff958f2f1c17647/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e342e31)4.1`< 4.2`2Laminas Log[![OSS Lifecycle](https://camo.githubusercontent.com/f5c00e7baad446b2e8914d194f223657cebf87ecbc39d74ae8f41508f605c460/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e312532464f53534d45544144415441)](https://camo.githubusercontent.com/f5c00e7baad446b2e8914d194f223657cebf87ecbc39d74ae8f41508f605c460/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e312532464f53534d45544144415441)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/ed74fc02ac973bce5914ca3f22d896d03d415c27932ebfcfafab7a1383d4fc09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e312e31)](https://camo.githubusercontent.com/ed74fc02ac973bce5914ca3f22d896d03d415c27932ebfcfafab7a1383d4fc09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e312e31)4.0`< 4.1`1Laminas Log[![OSS Lifecycle](https://camo.githubusercontent.com/a023d184917a9a3fe6765757cc27c61245c2ce6d49050f81ad014d474e0e7df7/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e302532464f53534d45544144415441)](https://camo.githubusercontent.com/a023d184917a9a3fe6765757cc27c61245c2ce6d49050f81ad014d474e0e7df7/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246342e302532464f53534d45544144415441)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/8234585c79006052b7cbe92e6f88656668319d05ae180c7cc245d14d1b84d1f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e302e32)](https://camo.githubusercontent.com/8234585c79006052b7cbe92e6f88656668319d05ae180c7cc245d14d1b84d1f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e302e32)3.0`< 4.0`1Laminas Log[![OSS Lifecycle](https://camo.githubusercontent.com/df3398ece619e41d357966118f72d65777edfddaac5a5f15930aae17b5419c74/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246332e302532464f53534d45544144415441)](https://camo.githubusercontent.com/df3398ece619e41d357966118f72d65777edfddaac5a5f15930aae17b5419c74/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c653f66696c655f75726c3d68747470732533412532462532466769746875622e636f6d253246646f746b65726e656c253246646f742d6572726f7268616e646c6572253246626c6f62253246332e302532464f53534d45544144415441)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/32908754269462021a9599ad8fb600b7021475a64ba9c5e4210c54ce70eaca69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f332e342e31)](https://camo.githubusercontent.com/32908754269462021a9599ad8fb600b7021475a64ba9c5e4210c54ce70eaca69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f332e342e31)Documentation
-------------

[](#documentation)

Documentation is available at:

Badges
------

[](#badges)

[![OSS Lifecycle](https://camo.githubusercontent.com/205f19f0b458547595f7b97f6132b774e42e515a1f3226d1dc628458516c531a/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d6572726f7268616e646c6572)](https://camo.githubusercontent.com/205f19f0b458547595f7b97f6132b774e42e515a1f3226d1dc628458516c531a/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d6572726f7268616e646c6572)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/9303efa9108efceed0b17bb01d97588b88432f657ba15cb64646aaf766a54fbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e342e30)](https://camo.githubusercontent.com/9303efa9108efceed0b17bb01d97588b88432f657ba15cb64646aaf766a54fbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d6572726f7268616e646c65722f342e342e30)

[![GitHub issues](https://camo.githubusercontent.com/86fb7f3be034a102b474d2df681776a086059b1643b0f62a39077ddcb6545072/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646f746b65726e656c2f646f742d6572726f7268616e646c6572)](https://github.com/dotkernel/dot-errorhandler/issues)[![GitHub forks](https://camo.githubusercontent.com/74c34d2b748078456694949dab5cdda60e1a2055a4cb9a49c77dedd5b631f343/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f646f746b65726e656c2f646f742d6572726f7268616e646c6572)](https://github.com/dotkernel/dot-errorhandler/network)[![GitHub stars](https://camo.githubusercontent.com/c9ff604e504d12a90c85b7a8c92170cbe1b419ede8afe25be01a423dbdc5a7d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f646f746b65726e656c2f646f742d6572726f7268616e646c6572)](https://github.com/dotkernel/dot-errorhandler/stargazers)[![GitHub license](https://camo.githubusercontent.com/4924e050b466434311c571cb4d3ca722edf24654b52427cd390dbe4947512b07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f746b65726e656c2f646f742d6572726f7268616e646c6572)](https://github.com/dotkernel/dot-errorhandler/blob/4.1/LICENSE)

[![Build Static](https://github.com/dotkernel/dot-errorhandler/actions/workflows/continuous-integration.yml/badge.svg?branch=4.1)](https://github.com/dotkernel/dot-errorhandler/actions/workflows/continuous-integration.yml)[![codecov](https://camo.githubusercontent.com/5d24ed97a76e722acee9153be9bb4f1d4f6ad9daaaf6df8c5ace6f22e5e5dff2/68747470733a2f2f636f6465636f762e696f2f67682f646f746b65726e656c2f646f742d6572726f7268616e646c65722f6272616e63682f342e312f67726170682f62616467652e7376673f746f6b656e3d304b494a415253355253)](https://codecov.io/gh/dotkernel/dot-errorhandler)[![PHPStan](https://github.com/dotkernel/dot-errorhandler/actions/workflows/static-analysis.yml/badge.svg?branch=4.1)](https://github.com/dotkernel/dot-errorhandler/actions/workflows/static-analysis.yml)

Adding the error handler
------------------------

[](#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

> If you need other error handlers, you should place them before dot-errorhandler in the pipeline; else it will not be able to catch errors. We recommend using just one error handler unless you have an error-specific handler.

- Configure the error handler as shown below.

In `config/autoload/error-handling.global.php`:

```
