voku / error-handler-lib
Portable PHP error-handler library with integration hooks for application-specific logging and rendering.
0.0.1
2026-06-09 22:38 UTC
Requires
- php: ^8.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
README
A small, portable PHP error-handler library with application integration hooks for logging, rendering, filtering, and object descriptions.
The package is designed to be installed through Composer and then adapted by the host application through ErrorHandlerIntegrationInterface.
Installation
composer require voku/error-handler-lib
Usage
<?php declare(strict_types=1); use voku\ErrorHandlerLib\ErrorHandlerLib; (new ErrorHandlerLib())->register(); ErrorHandlerLib::reportWarning('Deprecated path used.'); ErrorHandlerLib::reportError('Unexpected state detected.');
For application-specific behavior, provide an integration:
<?php declare(strict_types=1); use voku\ErrorHandlerLib\ErrorHandlerLib; use voku\ErrorHandlerLib\ErrorHandlerIntegrationInterface; final class ApplicationErrorIntegration implements ErrorHandlerIntegrationInterface { // Implement logging, sanitizing, rendering, and environment decisions here. } ErrorHandlerLib::useIntegration(new ApplicationErrorIntegration()); (new ErrorHandlerLib())->register();
Development
composer install
composer test
composer phpstan
composer ci