In the same way than @Razor, we can create a shorter global function/helper, ddx(), that will automatically dump, die, and expand without limit:
use Symfony\Component\VarDumper\VarDumper;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
/**
* Dump, die and expand
*
* @param mixed $vars
* @return never
*/
function ddx(mixed ...$vars): never
{
$cloner = new VarCloner();
$cloner->setMaxItems(-1); // No limit on the number of items
$dumper = new HtmlDumper();
$dumper->setDisplayOptions(['maxDepth' => 999999999]);
VarDumper::setHandler(function ($var) use ($cloner, $dumper) {
$dumper->dump($cloner->cloneVar($var));
});
foreach ($vars as $var) {
VarDumper::dump($var);
}
die(1);
}