How to monitor the status of jobs in Laravel?

In Laravel, you can monitor the status of jobs using Laravel Horizon. Laravel Horizon is an open-source package that provides a beautiful dashboard and code-driven configuration for monitoring and managing Laravel queue workers.

Here are the steps to monitor the status of jobs in Laravel using Laravel Horizon:

  1. Install Laravel Horizon by running the following command:
composer require laravel/horizon
  1. After installing Laravel Horizon, you need to publish its configuration file by running the following command:
php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider"
  1. Next, you need to run the Horizon installation command to create necessary tables and configuration files:
php artisan horizon:install
  1. Start the Horizon worker process by running the following command:
php artisan horizon
  1. By default, Laravel Horizon is accessible at /horizon endpoint. You can visit http://your-domain.com/horizon to access the dashboard.

  2. In your Laravel application, whenever you dispatch a job using Laravel's built-in Job Dispatching feature, it will be displayed on the Horizon dashboard along with its status and processing time.

That's it! Now you can monitor the status of your jobs using Laravel Horizon dashboard. It provides various useful features like monitoring failed jobs, real-time metrics, and configuration options to fine-tune your queue workers.