Loading, please wait...

picture of me
Joe Rushton Fullstack Web Developer

A Better Die and Dump for Laravel

11th March 2019 Reading Time: 1 mins
Tags: PHP Laravel Open Source

I've always felt like laravels dd() and dump() helpers were missing something but couldn't quite put my finger on it. I appreciate they are using the awesome Symfony Var Dumper under the hood (well, not exactly "under the hood" since you're actually directly using that when you use them helpers), but it definitely feels like there's some super essential quality of life functionality missing.


You're having a hard time debugging an issue, you're dropping dumps (pardon the pun) left right and center. You notice something odd about the data in front of you but you've scattered that many dumps across your code (okay, I'll stop now) that you have to step through the entire process again just to figure out which dang line you are looking for.


Enter Better DD: A package I whipped up in about 30 minutes which features two functions:


The "L" stands for line, as these step-in replacements do exactly the same as the original dd/dump whilst also including the filepath and line number right above the output. Simple eh?

Laravel Dump Helper


Just run

composer require joeyrush/better-dd

and off you go!


View Better DD on Github

Back to Homepage

Find me on social media