Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Horizon Watcher

Laravel Horizon Watcher Laravel Package

spatie/laravel-horizon-watcher

Run Horizon locally with auto-restarts on code changes. Adds an artisan command horizon:watch that starts Horizon and restarts it whenever PHP (or configured) files are created, updated, or deleted—great for avoiding stale workers during development.

View on GitHub
Deep Wiki
Context7

Automatically restart Horizon when local PHP files change

Frequently asked questions about Laravel Horizon Watcher
How does spatie/laravel-horizon-watcher differ from manually restarting Horizon?
Instead of manually running `php artisan horizon`, this package uses filesystem events to auto-restart Horizon whenever PHP files (e.g., jobs, workers, or config) change. It’s designed to save time during local development by eliminating the need to remember restarts after code updates.
Will this work in production or only local environments?
This package is **explicitly for local development only**. It’s not recommended for production due to the risk of abrupt worker terminations and potential state loss. Always exclude it from CI/CD pipelines or deployment scripts.
Do I need to configure anything after installing via Composer?
No configuration is required for basic usage. Just run `php artisan horizon:watch` to start Horizon with auto-restart on file changes. Optionally, publish the config to customize watched paths or ignored files.
Can I use this with Laravel Horizon v4 or older?
No, this package requires **Laravel Horizon v5.0+** due to dependency updates. If you’re on an older version, you’ll need to upgrade Horizon first or explore alternative solutions like custom watch scripts.
What happens if my job is long-running or holds in-memory state?
Auto-restarts may abruptly terminate workers, causing state loss (e.g., cached jobs or open connections). For stateful jobs, consider disabling the watcher or using Horizon’s `--once` flag for testing instead.
How do I exclude certain directories (e.g., node_modules, IDE temp files) from triggering restarts?
Use Horizon’s `ignore_files` configuration in `config/horizon.php` to exclude paths. For example, add `'ignore_files' => [storage_path('logs/*'), app_path('Temp/*')]` to prevent false restarts.
Does this work inside Docker or WSL environments?
Filesystem event detection may behave differently in Docker/WSL. Ensure volume mounts are properly configured, and test thoroughly. Some users report needing `--privileged` mode or custom event handlers for reliable behavior.
Can I integrate this with Laravel Valet or Laravel Sail?
Yes, it works seamlessly with Valet (auto-reload compatible) and Sail (if using Docker volumes). For Sail, ensure your `docker-compose.yml` mounts the correct paths for filesystem events to trigger.
What if I’m not using Laravel Horizon but another queue system (e.g., RabbitMQ, SQS)?
This package **only works with Laravel Horizon**. If you’re using raw Laravel queues or alternative systems, you’ll need a custom solution like `nodemon` or `entr` to monitor files and restart workers.
How do I debug false restarts or missed file changes?
Enable Horizon’s logging (`'logging' => true` in `config/horizon.php`) to track restarts. The package also logs filesystem events—check Laravel’s logs for details. For advanced debugging, extend the config to add custom event handlers.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport