Blog Detail

08

Nov
Automatically Restart Horizon When Local PHP Files Change cover image

arrow_back Automatically Restart Horizon When Local PHP Files Change

How many hours have lost debugging local jobs only to find out that you forgot to restart Horizon?

Laravel Horizon Watcher package contains an Artisan command horizon:watch that will start Horizon and automatically restart it when any PHP file is created, updated, or deleted.

This command is meant to be used in the local environment.

Installation

You can install the package via composer:

composer require spatie/laravel-horizon-watcher --dev

In your project, you should have the JavaScript package chokidar installed. You can install it.

via npm

npm install chokidar

or Yarn

yarn add chokidar

Optionally, you can publish the config file with this command:

php artisan vendor:publish --tag="horizon-watcher-config"

Usage

Run this command

php artisan horizon:watch

to start Horizon. When a PHP file in your project gets created, updated, or deleted, Horizon will automatically restart.

For more details and source code, please visit Github.

Closing Note

The team of Codebrisk Laravel developers is always ready to execute even your boldest ideas. Our expert team can design and develop any type of custom CRM solution, SAAS app, or e-commerce app to meet our customer’s needs and transform our customer’s experiences. Get in touch with our team to discuss your bespoke ideas and learn more about the next steps to launching cooperation.

Published at : 08-11-2022

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project