flextype-components/errorhandler

Error Handler Component for errors handling.

v1.0.5 2018-12-13 23:08 UTC

This package is auto-updated.

Last update: 2024-11-14 19:25:21 UTC


README

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