

When debugging a script that renders a web page, the var_dump or dump output is shown in the browser. You might start to capitalize certain things in the hope that it catches your eye when it is in between a lot of output: dump('I AM HERE'). It's hard to have a hierarchy for the importance of certain statements. I certainly lost time because I couldn't quickly find all locations anymore. When you have fixed your bug, it might be a chore to hunt down all the locations where you've put a debugging statement. When debugging a medium-sized problem, you might put var_dump or dump statements in multiple files. If you forget to remove a var_dump or similar statement before pushing to production, you're now displaying debugging information in production. "Dump and die" debugging also has some drawbacks of its own: I believe that, because it's so easy to do, most developers, including myself, reach this debugging approach. It's easy to add and remove var_dump, dump, and related calls.

In most cases, dumping stuff won't slow down your code. You can see program state from multiple time steps at once. Xdebug only show you the application in one frozen state (granted you can step through). You don't need to install or set up extra software. The "dump and die" approach has a lot of advantages.

PHP developers that don't use Xdebug for debugging are amateurs.- Derick Rethans June 20, 2020Ī lot of people, including myself, strongly disagree with Derick on this one. When you execute your code, these dump statements allow you to see the contents of variables and discover which parts are being executed.Ī few months ago the author of Xdebug tweeted this controversial statement: To find bugs, you'd put var_dump or dump calls in your code. The second way of debugging could be called the "dump and die" approach. Though the recently released v3 of Xdebug contains improvements on both fronts, it can still be daunting to set up. It can be hard to install, and it potentially has a significant negative impact on your code's performance. There are a couple of drawbacks, however. Created by Derick Rethans, this incredibly powerful PHP extension allows you to pause the code, set breakpoints, inspect, and change any variable. When debugging in PHP, you can choose between two approaches.įirst up is Xdebug. If you just want to know what Ray is, head to the Ray homepage.

In this blog post, I'd like to share why and how we've built Ray. Ray is available for macOS, Windows and Linux. It has a lot of features that help you find and fix bugs faster. Ray is a dedicated window to send dumped values to. I'm proud to announce the immediate release of Ray, a desktop app that vastly improves your debugging experience.
