Xdebug is configured out-of-the-box in container for all CLI commands. Try it:
To use xdebug in CLI, you need to use xphp
alias inside docker container. Eg.:
- Open api/src/Command/SecretsExternalDecryptToFileCommand.php in PhpStorm (or other IDE) and place a xdebug breakpoint on the first line of execute method.
- Check if Listening for PHP Debug Connections icon is in listening mode.
docker exec -it symfony-react-skeleton_php sh -l
xphp bin/console secrets:external:decrypt-to-file foo
- If asked by PhpStorm to provide server mappings, do it like this
- Debugger should stop at your breakpoint, and you should see all debug info.
I recommend to install Xdebug helper, or other similar tool to add XDEBUG_SESSION cookie to requests.
- Open api/src/Controller/HealthController.php in PhpStorm (or other IDE) and place a xdebug breakpoint on the first line of index method.
- Check if Listening for PHP Debug Connections icon is in listening mode.
- Perform http://localhost:81/health request from your browser (with a XDEBUG_SESSION cookie, see description few lines before)
- If asked by PhpStorm to provide server mappings, do it like this
- Debugger should stop at your breakpoint, and you should see all debug info.