Debugging with Xdebug

To debug plugin code with Xdebug and PhpStorm:

  1. Configure PhpStorm for CLI debugging
  2. Run Psalm with Xdebug enabled:
XDEBUG_MODE=debug XDEBUG_SESSION=1 PSALM_ALLOW_XDEBUG=1 vendor/bin/psalm --threads=1 --no-cache

--threads=1 is required so Psalm runs in a single process (breakpoints don’t work in forked workers). PSALM_ALLOW_XDEBUG=1 prevents Psalm from restarting itself without Xdebug (it does this by default for performance).


This site uses Just the Docs, a documentation theme for Jekyll.