Error Handler Component

version
MIT License

preview

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


Download

Download on the Github