flextype-components / errorhandler
Error Handler Component for errors handling.
Installs: 1 229
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.1.3
README
Error Handler Component for errors handling.
Installation
composer require flextype-components/errorhandler
Usage
use Flextype\Component\ErrorHandler\ErrorHandler;
Set error reporting level
$show_errors = true; if ($show_errors) { define('DEVELOPMENT', true); error_reporting(-1); } else { define('DEVELOPMENT', false); error_reporting(0); }
Set LOGS_PATH constant
define('LOGS_PATH', 'path/to/logs');
Set Error handler
set_error_handler('Flextype\Component\ErrorHandler\ErrorHandler::error'); register_shutdown_function('Flextype\Component\ErrorHandler\ErrorHandler::fatal'); set_exception_handler('Flextype\Component\ErrorHandler\ErrorHandler::exception');
License
See LICENSE