πŸš€ Laravel Horizon: A Step-by-Step Guide For Managing Queues Like A Pro

Queue Jobs Laravel Horizon
Profile Picture Joton Sutradharβ€’ πŸ“– 4 min read β€’ πŸ“… 2nd June 2025

Heads up!

Check my blogs on Dev.to and Medium!

Queues are essential for building scalable and performant Laravel applications. Whether you're sending emails, processing files, or executing time-consuming tasks, queues offload work and keep your app fast. But how do you monitor and manage them effectively?

Laravel Horizon is the answer.

Horizon is a beautifully designed dashboard and code-driven configuration tool for Laravel queues powered by Redis. In this blog, you'll learn how to set up, configure, and monitor queues using Horizon—step by step.

πŸ”§ Step 1: Prerequisites

Before installing Horizon, ensure you have:

  • Laravel 8 or higher

  • Redis installed and running

  • Laravel configured to use the redis queue driver

πŸ§ͺ Tip: You can use services like Laravel Valet or Docker to run Redis locally.

πŸ“¦ Step 2: Install Laravel Horizon

Install Horizon using Composer:

composer require laravel/horizon

Once installed, publish the Horizon configuration:

php artisan horizon:install

This command publishes a new config file:

config/horizon.php

You can also publish assets if needed:

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

βš™οΈ Step 3: Configure Horizon

Horizon works out of the box, but you can customize it in config/horizon.php.

For example, configure your supervisors:

'supervisor-1' => [
    'connection' => 'redis',
    'queue' => ['default'],
    'balance' => 'simple',
    'processes' => 3,
    'tries' => 3,
],

πŸ› οΈ Step 4: Set Queue Driver to Redis

Ensure your .env file has the correct queue driver:

QUEUE_CONNECTION=redis

Also, verify your config/queue.php is using Redis for the driver.

🚦 Step 5: Start Horizon

To start Horizon and begin processing jobs:

php artisan horizon

You can also start it in the background (e.g., for production):

php artisan horizon:supervisor

For long-running Horizon, use a process monitor like Supervisor (Linux) or systemd.

🌐 Step 6: Access the Horizon Dashboard

Visit:

http://laravel.test/horizon

Then you will get like this dashboard

 

 

You’ll see a beautiful dashboard showing:

  • Job metrics

  • Failed jobs

  • Queue throughput

  • Active workers

  • Redis usage

Protecting Horizon

Add this route protection to limit access (e.g., only to admins):

Horizon::auth(function ($request) {
    return auth()->check() && auth()->user()->isAdmin();
});

Put this in your AppServiceProvider or a custom service provider under boot().

πŸ“Š Step 7: Monitor & Manage Jobs

From the Horizon dashboard, you can:

  • Monitor queue performance in real-time

  • Retry or delete failed jobs

  • View job payloads and execution history

  • Manage worker processes

πŸ§ͺ Bonus: Horizon Artisan Commands

Useful Horizon commands:

  • php artisan horizon: Start Horizon

  • php artisan horizon:pause: Pause all workers

  • php artisan horizon:continue: Resume paused workers

  • php artisan horizon:terminate: Stop all workers after current jobs

  • php artisan horizon:status: Show Horizon status

βœ… Summary

Laravel Horizon is a powerful tool for monitoring your Redis queues in real time. It gives you full control over how jobs are processed, retried, and balanced—without needing to dive into the terminal for every job failure.

To recap:

  1. Install Horizon

  2. Configure Redis and Horizon

  3. Start and monitor queues via the dashboard

  4. Secure access

  5. Optimize job processing with multiple supervisors

🧠 Final Thoughts

If you're running a Laravel app with queues in production, Horizon is a must-have. It saves time, provides clarity, and gives you peace of mind knowing your job processing is under control.

Have you used Horizon in your projects? Share your experience or questions in the comments below!

 

Related Blogs
Supercharge Your Laravel App With Queues – A Developer’s Experience With Background Email Sending
Laravel Jobs Queue Queue Jobs Php Joton Sutradhar

As Laravel developers, one of the critical lessons we eventually learn is: not everything should happen in real-time. Whether it's sending emails, processing images, syncing third-party data, or running analytics β€” pushing these resource-heavy or time-consuming tasks to the background is essential for a performant and responsive application.

Profile Picture Joton Sutradhar β€’ πŸ“– 6 min read β€’ πŸ“… 29th May 2025
Mastering The Laravel App Service Pattern
Laravel PHP Service Pattern

As your Laravel application grows, keeping your code organized becomes more important than ever. A bloated controller quickly becomes hard to read, test, and maintain. One of the best solutions to this problem is using the Service Pattern β€” a pattern that helps separate your business logic from your controllers.

Profile Picture Joton Sutradhar β€’ πŸ“– 6 min read β€’ πŸ“… 27th May 2025
Integrating Meilisearch With Laravel Using Docker
Laravel Meilisearch Docker Integrating Laravel & Meilisearch

If you're building a Laravel application and want blazing-fast search capabilities, Meilisearch is one of the best tools you can integrate. In this post, we’ll explore what Meilisearch is, why you should consider it, its use cases, pros and cons, and how to integrate it into a Laravel project using Docker.

Profile Picture Joton Sutradhar β€’ πŸ“– 5 min read β€’ πŸ“… 26th May 2025
Subscribe to my newsletter

Get recent projects & blog updates to your inbox.

I never share your email. Read our privacy policy.

© 2025 Joton Sutradhar. All rights reserved.