Automatically running Laravel queue worker and scheduler using PhpStorm
I recently switched to Laravel Valet instead of Laravel Sail. However, I wasn't sure on the best way to run Laravel's scheduler and queue worker locally when working on my projects. Luckily, PhpStorm has a feature called startup tasks which work great for this use case.
-
In PhpStorm config, head to Tools > Startup Tasks
-
Add a new configuration and select Shell Script

-
Give the run configuration a name (e.g. "Laravel Scheduler")
-
Select Script text and enter the artisan command (e.g.
php artisan schedule:work) -
If you want these tasks to appear in the "Run" view in PhpStorm instead of in a new terminal, untick the Execute in terminal box

-
Repeat this process for the queue worker
php artisan queue:listencommand -
That's it! Now, every time you open your project these tasks will automatically be run in the background. Minimize the Run tab and get back to work!
