Search code examples
laravelxdebuglaravel-saillaravel-9

Sail - Initiate Xdebug session from command line


So the last version of Sails makes it very easy to use Xdebug. Basically just had to define SAIL_XDEBUG_MODE in the .env file, configure path mapping in PhpStorm, activate listening and all was set - it works perfectly from the browser.

Now, how should I go if I want Xdebug to activate when I'm using the command line? Like when using artisan commands for seeding, or even better when using custom artisan commands created to run scripts to update some data... I can't find any arguments to add to my sail artisan myOwnCommand that would tell Xdebug it has to activate.

I'm working on Windows 11 with WSL2.

Thanks ahead!


Solution

  • Now you can use command debug to run with Xdebug (ex. sail debug myOwnCommand). Here is documentation: https://laravel.com/docs/9.x/sail#xdebug-cli-usage