dmitry-suffi / error-handler
Error handler
Installs: 84
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
Requires
- php: >=7.0.0
- psr/log: ~1.0
This package is auto-updated.
Last update: 2025-05-25 19:41:27 UTC
README
Error handling php. Can use any logger psr-3 for logging errors.
Installation
composer require dmitry-suffi/error-handler
connection example
$handler = new \suffi\ErrorHandler\ErrorHandler(); set_error_handler([$handler, 'errorHandler']); set_exception_handler([$handler, 'exceptionHandler']);
Setting
Debug mode. Displays error details.
$handler->debug = true;
Error Logging. Can use any logger psr-3 for logging errors.
$handler->writeLog = true; $handler->logger = $logger;
Writing to the log information
$handler->$debugLog = true;
When you inherit from the class, you can change the way display messages to the user fault conditioning.
//Page with an error message protected function htmlError(string $errstr) { return $errstr; } //Report an error for ajax-request protected function jsonError(string $errstr) { return json_encode(['error' => $errstr]); }