How to use the Laravel Horizon dashboard for monitoring jobs



Image not found!!

Laravel Horizon is a powerful dashboard and configuration system for the Laravel Queue worker. It provides a beautiful and convenient way to monitor and manage your queued jobs. Here's a step-by-step guide on how to use the Laravel Horizon dashboard for monitoring jobs, along with some additional useful links:

1. Install Laravel Horizon

Make sure you have Laravel installed. If not, you can install it using Composer:

bash
composer create-project --prefer-dist laravel/laravel your-project-name

Next, install Laravel Horizon:

bash
composer require laravel/horizon

2. Configure Laravel Horizon

After installation, publish the Horizon configuration file:

bash
php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider"

This will create a horizon.php file in your config directory.

3. Configure Your Queue Connection

Make sure your config/queue.php file is configured with the desired queue connection. Laravel Horizon relies on Laravel's queue system.

4. Set Up Horizon Environment

In your .env file, set the HORIZON_PREFIX variable to a unique value:

env
HORIZON_PREFIX=my-horizon

5. Migrate the Database

Run the Horizon database migrations:

bash
php artisan horizon:migrate

6. Start Horizon

You can start Laravel Horizon using the following command:

bash
php artisan horizon

7. Access the Horizon Dashboard

Visit http://your-app-url/horizon in your browser to access the Horizon dashboard.