PHP code example of brenno-duarte / prettyexception

1. Go to this page and download the library: Download brenno-duarte/prettyexception library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brenno-duarte / prettyexception example snippets


use PrettyException\PrettyException;

$exception = new PrettyException();

$exception = new PrettyException();
$exception->inPretty()->run();

$exception->setTitle('New Exception');

$exception->table('New Exception', [
    'exc' => 'test',
    'exc2' => 10
]);

$exception->tableCallback('New Exception Callback', function(\Whoops\Exception\Inspector $inspector) {
    $data = array();
    $exception = $inspector->getException();
    if ($exception instanceof SomeSpecificException) {
        $data['Important exception data'] = $exception->getSomeSpecificData();
    }
    $data['Exception class'] = get_class($exception);
    $data['Exception code'] = $exception->getCode();
    return $data;
});

$exception->closeTableAndRun($comment);

$run->runIfAjax('Exception in AJAX');
$run->runIfCli('Exception in CLI');