Allow me to admit a failing of mine. I always seem to have a problem getting Xdebug to work reliably. I actually felt like I had a pretty good handle on it using MAMP and PHPStorm. It mostly “just worked.” But after I added too many sites into MAMP, MAMP itself began to become unresponsive and frustrating to use. Sites seemed to run okay but anytime I tried to use MAMP’s interface I would be greeted with the Mac’s beachball of death. I finally got annoyed to the point of looking for an alternative. I landed on Local by Flywheel as a MAMP replacement and, so far, it has been pretty solid.
However, one thing that I never could seem to get set up correctly is Xdebug with Local and PHPStorm. It is especially galling because there is actually a Local plugin expressly made for the purpose of setting this up for you. And I am sure that I am missing something obvious and that it is not the fault of the tools. But I just kept struggling with it.

Then I heard about a different tool, Ray by Spatie. This tool had never been on my radar before but it had options for debugging with WordPress so I thought I would check it out.
Installation
Ray is a desktop application available for macOS, Windows and Linux. I downloaded the Mac version, installed like any other application, and it fired up.

Ray has a companion WordPress plugin in the WordPress Plugin Directory. I installed the plugin on my local website and, as the Ray documentation instructs, set the Environment variable in wp-config.php
to ‘local’.
define( 'WP_ENVIRONMENT_TYPE', 'local' );
That was it. After those few simple steps, Ray was ready to use.
What Ray Does
Ray has many tools to help understand what is going on in your WordPress application. Instead of using the trusty var_dump
or print_r
to your screen, you can tell Ray to display a variable in your code and it will format it nicely.

Pausing execution of your program can also easily be done. This is very handy in the instance of testing a checkout process, for example. Instead of needing to complete a new order every time to test, stop execution of the program before the order is finalized and removed from your cart. Then keep testing.
Ray even has some WordPress-specific functions. Want to see all of the queries run on a page? It is as simple as using ray()->showQueries();
.

Ray also can display mails sent in WordPress and show WordPress errors. For a fuller list of commands, take a look at Ray’s well-done documentation. When you want to see the output to Ray it is always just a keyboard shortcut away. A global key combination will bring Ray to the front.
Conclusion
As you can probably guess, I really like Ray and find it a solid and, importantly, easy to use substitute for Xdebug. I could see that sometimes it would be valuable to have the more powerful features of Xdebug like stepping through code and dynamically changing variables during a run. But I don’t usually find myself looking for that kind of control. Also, I can understand that some would be put off by the $49 annual license. But, for me, having these tools available in such a frictionless way is well worth the price.