Download the PHP package logger/errorhandling without Composer
On this page you can find all versions of the php package logger/errorhandling. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download logger/errorhandling
More information about logger/errorhandling
Files in logger/errorhandling
Download logger/errorhandling
More information about logger/errorhandling
Files in logger/errorhandling
Vendor logger
Package errorhandling
Short Description Errorhandling extension for PSR-3 compatible loggers
License MIT
Package errorhandling
Short Description Errorhandling extension for PSR-3 compatible loggers
License MIT
Please rate this library. Is it a good library?
Informations about the package errorhandling
ErrorHandling
Overview
- ErrorHandling provides drop‑in handlers that route all PHP problems to your PSR‑3 logger: notices, warnings, deprecations, assertions, exceptions, and many fatals.
- Designed for modern PHP (8.x, incl. 8.5) and integrates with logger/essentials out of the box, but works with any PSR‑3
LoggerInterface.
Requirements
- PHP >= 8.0
- A PSR‑3 compatible logger (e.g.,
logger/essentials)
Install
- Composer:
composer require logger/errorhandling
Quick Start
What It Does
- Exceptions for errors: Converts PHP error levels (by bitmask) into
ErrorExceptionyou can catch, or let bubble into the exception handler. - Assertion logging: Captures
assert()callbacks and logs message + file/line without emitting warnings. - Exception logging: Catches uncaught
Throwable, logs atcritical, and prints a readable stack trace to STDERR before exiting with status 1. - Fatal error logging: On shutdown, inspects the last error and logs
alertfor typical fatal types.
API
CoreErrorHandlers::enableExceptionsForErrors(int $bitmask = E_ALL): void- Throw
ErrorExceptionfor any error whose level matches$bitmask.
- Throw
CoreErrorHandlers::registerAssertionHandler(LoggerInterface $logger, string $logLevel): void- Route failed assertions to
$loggerat the given PSR‑3 level, withfileandlinecontext.
- Route failed assertions to
CoreErrorHandlers::registerExceptionHandler(LoggerInterface $logger): void- Log uncaught exceptions as
criticalwith rich context; prints stack trace and exits with code 1.
- Log uncaught exceptions as
CoreErrorHandlers::registerFatalErrorHandler(LoggerInterface $logger): void- On shutdown, log last fatal error (
E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR) asalert.
- On shutdown, log last fatal error (
Configuration Tips
- Call the registration methods early in your bootstrap so problems are captured.
- You can combine handlers (typical usage registers all of them).
- To exclude specific severities from becoming exceptions, pass a masked bitmask, e.g.
E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED.
Development
- Run tests:
composer run tests - Static analysis:
composer run phpstan
Compatibility Notes
E_STRICTis not handled specially (folded into other levels on modern PHP).- Handlers use
Throwable, not justException, to cover engine errors in PHP 7/8.
License
- MIT — see LICENSE for details.
All versions of errorhandling with dependencies
PHP Build Version
Package Version
The package logger/errorhandling contains the following files
Loading the files please wait ...