If you're using Xdebug for PHP debugging, there's a new version that just released today: Xdebug 3. Check out the announcement! Promising massive performance boosts, a simpler configuration paradigm, and support for the upcoming (tomorrow!) PHP 8.0 release.
Upgrading
To read about how to upgrade from Xdebug 2 to Xdebug 3, read the upgrade guide. Some highlights below:
Performance
The benchmarks of Xdebug 3 have shown that Xdebug 3 is 34% faster for step debugging, and 25% faster when in develop
mode. In addition, if you have the Xdebug extension installed, but aren't actively using it (features are disabled), Xdebug 3 is over 99% faster than Xdebug 2.
Configuration highlights
One of the big shifts with Xdebug 3 is the introduction of the xdebug.mode
ini setting. If you've ever struggled getting just the correct incantation or flavor of Xdebug ini settings to get debugging working, feast your eyes on this thing of beauty:
xdebug.mode=debug
That's it. No more deciphering if you need remote_enable
on, profiler_enable
on, or trying to remember what exactly remote_autostart
does.
Multiple Xdebug modes
You can combine Xdebug modes together with a comma. These other modes for xdebug.mode
are:
-
off
Everything isβahemβoff. This means you can have the extension installed but disabled, and a negligible performance hit. β¨ I'm guessing you can't really combine this with the other modes? π€·ββοΈ -
develop
Turns on development aids. If you like stack traces or ifvar_dump()
is your friend, you'll want this setting. -
coverage
If you're running code coverage reports with PHPUnit, turn this on. -
debug
Enables step debugging. π -
gcstats
Collect statistics about PHP's garbage collection mechanism. π -
profile
Use this to analyze performance with tools like KCacheGrind. -
trace
Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.
Time will tell, but I'm guessing xdebug.mode
on most of my projects will be:
xdebug.mode=develop,debug,coverage
Starting a step debug session
Remember the XDEBUG_CONFIG="idekey=wtf"
days? No longer. Now it's simplified to an XDEBUG_SESSION
environment variable to turn on step debugging. Set this environment variable to the key you'd like for that step debug session.
XDEBUG_SESSION=wtf
Step debugging? Port 9003
β οΈ Heads up: the default step debugging port has changed from port 9000 to port 9003.
Win, win, win: performance, simpler config, PHP 8 support
What's not to love about this release? I'm excited to be able to have the extension installed and available without a huge performance hit. I'm looking forward to simpler configuration. And tomorrow, PHP 8.0 will land, which is the first release to have JIT compiling.
Top comments (1)
Thannk you for this post. I was not excited about the new xdebug at all, but now I am. I just hope the migration will not turn into migraines.