An example of this is:Įxport XDEBUG_CONFIG="client_host=192.168.42.34 log=/tmp/xdebug.log" part shouldīe dropped from the setting name. user.ini files.Ī select set of settings can be set through an XDEBUG_CONFIGĮnvironment variable. Php.ini, files like 99-xdebug.ini, but also inĪpache's. Unless specifically mentioneds, each setting can be set in This section describes all available configuration settings available in Xdebug. Thanks to the path mappings contained in the docker-compose file you should not have any problems with matching coverage and files.If you find Xdebug useful, please consider supporting the project.
You can now click on "Run tests with Coverage" to generate code coverage that PHPStorm will display inline. Make sure you have set the coverage engine to "Xdebug" in the PHPStorm "Run Configuration" for your tests (see screenshot above). Run tests with coverage in PHPStorm with DDEV
PHPStorm will now stop at any breakpoint and allow you to step through the tests. Then choose a test and right-click -> Debug (or use the debug button). To debug tests in PHPStorm with DDEV, first enable xdebug in DDEV: ddev xdebug on If you need to make additional adjustments, go to the "Run Configuration" settings. This will create a new "Run Configuration". Running the tests in PHPStorm now works exactly in the same way as it does without DDEV, for example: click on a phpunit.xml file and choose "Run" from the context menu. Sed -r 's/ports:\f\s+\f\s+\f/ports: \\f/g' | \Īdd PHPStorm Docker-Compose PHP Interpreter # convert empty port: into empty array port: # convert newlines to formfeed (so we can do multiline replacment # Example: "ddev phpstormcompose build/docker-compose.yml"ĬOMPOSE_FILE=$ # Description: erxport a docker-compose.yml for use with php storm. Here's a host command you can use in DDEV to automate the creation of the file (Thanks to Chris Wolff):
Windows users should additionally check whether the first line contains logging output - if so: please delete that, too. In the file build/docker-compose.yml look for the "ports" part in the "web" container section and remove it. As we don't need that port configuration, we can get away with simply removing the offending lines. In the compose config we just dumped is a port configuration which PHPStorm (2021.1) cannot parse. This section is mainly necessary because of a bug in PHPStorm (tracked here: ), as it's already fixed in master, we can expect to get rid of this workaround soon.
However, DDEV has a debug command that is able to dump the "final" docker-compose config, which we can use to dump that in a PHPStorm compatible format: ddev debug compose-config > build/docker-compose.yml Adjust docker-compose.yml
This is how to do it: Dump docker-compose configĭDEV is using their own wrapper script to start docker-compose and does a few things in it that PHPStorm cannot directly understand - which is why we cannot use the docker-compose file of DDEV directly. Integrating via docker-compose has the advantage that path mappings for example are available automatically. As that seems a bit circular, I decided to try to directly integrate DDEV and PHPStorm via docker-compose. In a previous post I described using SSH to integrate DDEV and PHPStorm.