Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

A better dd() for your TDD

On the Tighten blog Keith Damiani wrote an article how you can mold the dd helper to your liking.

An important part of every Laravel developer’s debugging arsenal is the humble dd() helper function—”dump and die”—to output the contents of a variable and terminate execution of your code. In the browser, dd() results in a structured, easy-to-read tree, complete with little arrow buttons that can be clicked to expand or hide children of nested structures. In the terminal, however, it’s a different story.

Fortunately, it’s simple to build your very own customized version of dd() to help tame your unwieldly terminal output.


Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band.