2021-05-13 1034次浏览

Error handler package got its first release. This is generic PSR-15 and PSR-3 compatible error handling library.

The features are:

  • PSR-15 middleware for catching unhandled errors.
  • PSR-15 middleware for mapping certain exceptions to custom responses.
  • Production and debug modes.
  • Debug mode displays details, stacktrace, has dark and light themes and handy buttons to search for error without typing.
  • Takes PHP settings into account.
  • Handles out of memory errors, fatals, warnings, notices and exceptions.
  • Can use any PSR-3 compatible logger for error logging.
  • Detects response format based on mime type of the request.
  • Supports responding with HTML, plain text, JSON, XML and headers out of the box.
  • Has ability to implement your own error rendering for additional types.

Majority of technical implementation was battle-tested in Yii 1 and Yii 2 for more than 12 years. In Yii 3 version we have worked on error page design and readability as well so you can switch light/dark mode with a toggle right at the error screen.