wecodein / error-handling
Robust and extensible error handling system for PHP
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 1
Open Issues: 0
pkg:composer/wecodein/error-handling
Requires
- php: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.7
- php-mock/php-mock-phpunit: ^2.0
- phpunit/phpunit: ^6.4
This package is not auto-updated.
Last update: 2025-10-11 07:47:21 UTC
README
Installation
The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:
composer require wecodein/error-handling
Usage
use WeCodeIn\ErrorHandling\Handler\ExceptionHandler; use WeCodeIn\ErrorHandling\Handler\FatalErrorHandler; use WeCodeIn\ErrorHandling\Handler\HandlerAggregate; use WeCodeIn\ErrorHandling\Handler\ThrowableErrorHandler; use WeCodeIn\ErrorHandling\Processor\CallableProcessor; require __DIR__ . '/../vendor/autoload.php'; ini_set('log_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); $processor = new CallableProcessor(function (Throwable $throwable) : Throwable { // log, render... return $throwable; }); $handler = new HandlerAggregate( new ThrowableErrorHandler(), new ExceptionHandler($processor), new FatalErrorHandler(20, $processor) ); $handler->register(); trigger_error('Error');
Credits
License
Released under MIT License - see the License File for details.