Xdebug is a PHP extension that greatly simplifies the debugging process. Once installed and enabled, Xdebug generates easier to read error messages that include a backtrace. Xdebug also allows you to step through the life cycle of a Drupal page request in incredibly useful ways.
If you've installed Drupal on DDEV locally, Xdebug is included.
Example tasks
- Improve the formatting of error messages output to the browser
- Connect an IDE to allow setting breakpoints and inspecting the request lifecycle
- Enable and examine an application profile to find inefficiencies
Confidence
Xdebug is a PHP Extension. Generally speaking, it is installed and configured once per server. Once you set it up on your local development server you likely won't have to make any configuration changes at all.
Drupalize.Me resources
External resources
- Xdebug (xdebug.org)
- This is the official documentation, including extension downloads for your platform.
- DDEV: Step Debugging with Xdebug (ddev.readthedocs.io)
- Every DDEV project is automatically configured with Xdebug so that popular IDEs can do step debugging of PHP code. This documentation includes instructions for PhpStorm and VS Code.
- Configuring Xdebug (jetbrains.com)
- Another resource from the folks behind PhpStorm. This tutorial will help walk you through the most useful configuration options for Xdebug.
- Xdebug debugger (Drupal.org)
- This contains the recommendations and documentation on Drupal.org about setting up Xdebug specifically for use on Drupal projects.