Rufhausen's avatar

Expanding dd() (VarDumper) by default?

Does anyone know if it's possible to have the new dd() using vardumper expand x levels automatically for display, instead of having to drill down manually each time you need to look deeper into an object/array?

0 likes
9 replies
Marwelln's avatar

I would like this too. It's really time consuming to have to expand a level manually when it can be displayed without problems.

1 like
curtisblackwell's avatar

Doesn't expand by default, but I just threw this in a TextExpander snippet and paste it in the console to expand everything:

var compacted = document.querySelectorAll('.sf-dump-compact');

for (var i = 0; i < compacted.length; i++) {
  compacted[i].className = 'sf-dump-expanded';
}

The arrows don't get replaced, but ¯_(ツ)_/¯.


I also just learned that you can cmd + click (probably ctrl + click on non-Macs) an arrow to recursively expand a single object/array.

17 likes
Mohannad's avatar

Thanks to @curtisblackwell , in order to automate this I'm using Tampermonkey chrome extension, this is the generated script in case someone want to copy it quickly :)

// ==UserScript==
// @name         Expand `dd` Symfony's VarDumper Component
// @description  see: https://laracasts.com/discuss/channels/general-discussion/expanding-dd-vardumper-by-default
// @author       curtisblackwell
// @include        http://localhost*
// @include        http://my-another-custom-domain*
// ==/UserScript==

(function() {
    'use strict';
var compacted = document.querySelectorAll('.sf-dump-compact');

for (var i = 0; i < compacted.length; i++) {
  compacted[i].className = 'sf-dump-expanded';
}

})();
7 likes

Please or to participate in this conversation.