Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Tighten.co:
A better dd() for your TDD
Oct 13, 2016 @ 16:57:45

On the Tighten.co blog they have a recent post sharing a better dd() for your TDD - basically a better method for debugging the current state of object with a "dump and die" function.

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 unwieldy terminal output—helping you find the details you're interested in quickly, without wearing out your trackpad (and your patience).

He provides two options you can use to help clean up the output of a "dump or die" method from the extensive results the current "dd" function provides:

Kint provides a few other helper methods you can use and easily configurable max and min depth to show in the output.

tagged: tdd testing vardumper kint library package output debugging

Link: https://blog.tighten.co/a-better-dd-for-your-tdd


Trending Topics: