However, I frequently forgot to run
php artisan horizon when opening the project, and sometimes spent a bit of time trying to figure out why a job hadn’t run before remembering. 🤦
In addition—and this is a relatively minor annoyance—even when I do remember to start Horizon, sometimes I’d like to see the metrics dashboard showing how many jobs have run in the past few minutes.
Enter VS Code’s Tasks feature. This can automatically start running tasks when a workspace is opened.
To get set up:
- Open the command palette (command-shift-P) and activate “Tasks: Manage Automatic Tasks in Folder”
- Activate “Allow Automatic Tasks in Folder”
- Open the command palette again and activate “Tasks: Open Workspace Tasks”
- Add the following to the workspace:
Now every time I open the workspace, both Horizon and the scheduler run automatically.