Skip to content

Zelasli Debugger module for handling errors and exception.

License

Notifications You must be signed in to change notification settings

zelasli/debugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zelasli Debugger

Zelasli Debugger module for handling errors and exception and display the errors when the debug mode is on otherwise it display an eror message.

Demo

Include the required classes and initialize the debugger.

include 'path/to/file/Engine.php'
include 'path/to/file/Handler.php'
include 'path/to/file/RenderExceptionInterface.php'

// First parameter is the debug mode type
// Second parameter is the debug environment type (production or development)
$debugger = new Engine(true, 'development');

// To start the debugger and handler.
$debugger->initialize();

You can also customize the default handler rendering view by using the RenderExceptionInterface

class PageNotFoundException extends Exception implements RenderExceptionInterface
{
    public function render()
    {
        // TODO: implement PageNotFoundException view
        $view = "<h1>Page not Found (404)<h1>";

        return $view;
    }
}