Let\'s face it, debug_backtrace()
output is not very pretty. Did anyone code a wrapper?
And what\'s your favourite pretty var_dump()
(which is
You also have kint
(github repo) which has a composer
package on the packagist
repository
So either download the library manually or with composer
, it's just a matter of :
$ composer init
$ composer require raveren/kint
$ composer install
Then, instead of ini_set('display_errors', 'On');
, I prefer to use this simple handler in my main (first) include file :
if ( getenv('__project_env__') === 'DEV') {
error_reporting(E_ALL | E_STRICT);
function shutdown_handler() {
$error = error_get_last();
Kint::trace();
Kint::dump($error);
}
register_shutdown_function('shutdown_handler');
} else {
...
}
With __project_env__
being set in Apache's Virtualhost (SetEnv __project_env__ "DEV"
) so as not to pollute the different branches of the git
repository where the project lives with configuration items which are by essence environmental
Here is a screenshot of how the trace looks (each step is collapsible):
(source: github.io)