Created
March 6, 2017 12:30
-
-
Save vkuzmov/d69eed705268aaf771ebdc0725f3d1a6 to your computer and use it in GitHub Desktop.
Laravel - automatically expand strings printed with dd()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PUT THIS IN bootstrap/autoload.php (at the end) | |
/** auto-expand DD */ | |
function dd() | |
{ | |
array_map(function ($x) { | |
(new Illuminate\Support\Debug\Dumper)->dump($x); | |
}, func_get_args()); | |
// Added to auto-expand dd() output | |
if (PHP_SAPI !== 'cli') { | |
echo "<script> | |
var tg = document.querySelectorAll('.sf-dump-str.sf-dump-str-collapse'); | |
[].forEach.call(tg, function(item) { | |
item.className = 'sf-dump-str sf-dump-str-expand'; | |
item.querySelector('.sf-dump-str-toggle').remove(); | |
}); | |
</script>"; | |
} | |
die(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with laravel 5.8 i did this