jinnguyen/puja-error

Puja-Error are the handler layers, that handle all fatal exceptions/errors ( include fatal errors) from PHP application. Support callback function

v1.0.0 2016-12-05 12:01 UTC

This package is not auto-updated.

Last update: 2024-04-22 12:24:14 UTC


README

Puja-Error are the handler layers, that handle all errors/exceptions for PHP application.

Install

composer require jinnguyen/puja-error

Usage

include '/path/to/vendor/autoload.php';
use Puja\Error\ErrorManager;

Examples

class A
{
    public function b(array $erroMessage = array())
    {
        print_r($erroMessage); // viewsource to see how this function work
    }
}


use Puja\Error\ErrorManager;
new ErrorManager(array(
    'enabled' => true, // toggle on/off Error Manager
    'debug' => true, // toggle on/off mode DEBUG
    'error_level' => E_ALL, // same with error_reporting()
    'callback_fn' => array(new A(), 'b')) // callback function, will call after application get error (you can do some stuff like: log errors, roll back db transaction, ...)
);


$a = new A();
$a->c();

Result
puja-error-demo.png