Debugging
You can use RoadRunner with the Xdebug extension. To enable it, configure your IDE to accept remote connections.
Xdebug for RoadRunner installed on your system

To activate Xdebug, set xdebug.mode=debug in your php.ini.
To enable Xdebug in your application, set the environment variable XDEBUG_SESSION:
Please keep in mind this guide: xdebug3.
You should be able to use breakpoints and view state at this point.
PhpStorm notes
Xdebug for RoadRunner in Docker
The application image below uses the official RoadRunner v3 image.
First, create a docker-compose.yml file in your project root, or copy the environment and extra_hosts sections into your existing docker-compose.yml:
Create api/public/ for the static middleware. Put the PHP worker and its Composer dependencies in api/, which is mounted at /app. Create api/.rr.yaml with this configuration:
Next, create a Dockerfile in your project root or copy the following content:
The example uses Xdebug 3.5.3 and runs as the app user.
Next, create an xdebug.ini file in your project root or copy the following content:
Next, change the settings in your IDE so it can accept remote connections. For example, in PhpStorm go to PHP > Debug and set the following options:

Next, create a Server entry in your IDE. For example, in PhpStorm go to PHP > Servers and set the following options:

Also check the Docker settings in your IDE. For example, in PhpStorm go to Build, Execution, Deployment > Docker and set the following options:

Jobs debugging
Prerequisites
Xdebug 3 installed and properly configured.
Number of jobs workers set to
1withjobs.pool.num_workersconfiguration option in.rr.yaml.
Debug process
If you have any active Xdebug listener while starting RoadRunner with Xdebug enabled, disable it. This will prevent a false-positive debug session.
Once RoadRunner starts all workers, enable XDebug listener and reset jobs workers with:
Now you should see the debug session started:
Step over to where the job task is being resolved with
$consumer->waitTask().As soon as you reach it, the debugger stops but the session remains active.
Trigger task consumption with either an HTTP request or a console command (depending on how your application works), and continue debugging the job worker within the active session.
You can continue debugging jobs as long as the debug session is active.
If the connection/session is broken or times out, you can repeat the instructions above to reestablish the connection by resetting job workers.
Last updated