Watch: DDEV, PhpStorm, and Xdebug Debugging
The days of print-debugging are long behind us! Xdebug and PHP IDEs have made that approach unwieldy, but often the configuration between your IDE, PHP, web server, and Docker is challenging and fragile. Enter our open source local development environment, DDEV.
The combination of PhpStorm and DDEV‘s plug-and-play approach to debugging makes those configuration struggles obsolete. You can get a working debug environment in a few minutes! We’ll walk you through it in this screencast using macOS. It works exactly the same on Windows or Linux, and with WSL2 as well. After all, we want you to be successful with the tools and workflows you know and love.
Debugging in your local development environment
What we’re doing in this tutorial:
- Installing DDEV
- Installing PhpStorm (we use Homebrew here, but you can install it with a download)
- Setting a breakpoint
- Telling PhpStorm to listen for Xdebug
- Enabling DDEV Xdebug with
ddev xdebug on
- Visiting a page
- Configuring the initial popup that makes a “server” or file mapping for us
Outline:
- Overview (0:51)
- Installing DDEV (0:59)
- Installing PhpStorm (1:40)
- Creating a PhpStorm project and setting a breakpoint (2:24)
- Configure DDEV project (3:18)
ddev xdebug on
(4:12)- Creating a PhpStorm “server” or “mapping” automatically (5:14)
- First breakpoint! (5:42)
- Command-line debugging (8:00)
- Resources (9:58)
Resources for you:
- DDEV documentation: https://ddev.readthedocs.io
- DDEV Xdebug docs (including troubleshooting)
- Support docs: Drupal Slack and TYPO3 Slack #ddev, gitter #ddev, Stack Overflow, and the DDEV issue queue
- DDEV Project Repository
- More about PhpStorm on WSL2, with full details about how to run it