PHP code example of ovr / phalcon-pretty-exceptions
1. Go to this page and download the library: Download ovr/phalcon-pretty-exceptions 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/ */
ovr / phalcon-pretty-exceptions example snippets
//Requiring the file
ader
$loader = new Phalcon\Loader();
$loader->registerNamespaces(array(
'Phalcon\\Utils' => '/path/to/pretty-exceptions/Library/Phalcon/Utils/'
));
$loader->register();
set_exception_handler(function($e)
{
$p = new \Phalcon\Utils\PrettyExceptions();
return $p->handle($e);
});
$p = new \Phalcon\Utils\PrettyExceptions();
//Change the base uri for static resources
$p->setBaseUri('/');
//Set if the backtrace must be shown
$p->showBacktrace(true);
//Set whether if open the user files and show its code
$p->showFiles(true);
//Set whether show the complete file or just the relevant fragment
$p->showFileFragment(true);
/**
* Set whether show human readable dump of current Phalcon application instance
* Can optionally pass a Phalcon application instance as a prameter in the
* constructor, or as the last parameter of PrettyExceptions::handle() and
* PrettyExceptions::handleError()
*/
$p->showApplicationDump(true);
//Change the CSS theme (default, night or minimalist)
$p->setTheme('default');
//Handle the error/exception
//...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.