Skip to content

Instantly share code, notes, and snippets.

@jsenin
Created August 5, 2016 08:36
Show Gist options
  • Save jsenin/d264fd92fe66b9eca145ae8d0c057b08 to your computer and use it in GitHub Desktop.
Save jsenin/d264fd92fe66b9eca145ae8d0c057b08 to your computer and use it in GitHub Desktop.
improve dd laravel function
/**
* /vendor/laravel/framework/src/Illuminate/Support/helpers.php
*/
if (! function_exists('dd')) {
/**
* Dump the passed variables and end the script.
*
* @param mixed
* @return void
*/
function dd($object, $end = true)
{
(new Dumper)->dump($object);
$callers=debug_backtrace();
foreach($callers as $call) {
$line = empty($call['line']) ? false : $call['line'];
$file = empty($call['file']) ? false : $call['file'];
$class = empty($call['class']) ? false : $call['class'];
$function = empty($call['function']) ? false : $call['function'];
echo sprintf("\n[%s]: %s %s->%s", $line, $file, $class, $function );
}
if ($end) {
die();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment