Monitoring Queues with Laravel Horizon
Install Horizon and observe queue throughput and failed jobs.
Monitoring Queues with Laravel Horizon is a free PHP Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the PHP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What is Horizon?
Laravel Horizon provides a beautiful dashboard and configuration system for Redis-backed queues, offering real-time metrics, throughput tracking, and job monitoring.
Installing Horizon
Install via Composer and publish assets.
$ composer require laravel/horizon
$ php artisan horizon:install
$ php artisan migrateStarting Horizon
Start Horizon as a single long-running process (replaces queue:work).
$ php artisan horizonAccessing the Dashboard
The Horizon dashboard is available at /horizon by default. Gate access in production to authorised users only.
<?php
// In HorizonServiceProvider:
Horizon::auth(function ($request) {
return $request->user()?->isAdmin() ?? false;
});horizon.php Configuration
Configure workers (environments, supervisors, queue priorities, worker counts) in config/horizon.php.
// config/horizon.php
"environments" => [
"production" => [
"supervisor-1" => [
"connection" => "redis",
"queue" => ["emails", "default"],
"processes" => 10,
"balance" => "auto",
]
]
]Supervisors and Balancing
Horizon supervisors manage pools of workers. With "balance" => "auto", Horizon auto-scales workers based on queue depth.
Metrics Dashboard
The Horizon dashboard shows: jobs per minute, failed jobs, wait times, recent jobs, and per-queue statistics.
Tagging Jobs
Tag jobs for easier monitoring and filtering in the dashboard.
<?php
public function tags(): array
{
return ["user:".$this->user->id, "email"];
}
// Then filter by tag in the Horizon dashboardFailed Jobs in Horizon
View failed jobs with their exceptions and stack traces. Retry individual failed jobs directly from the dashboard or via Artisan.
$ php artisan horizon:forget <uuid>
$ php artisan horizon:retry-failedRunning in Production with Supervisor
Use Linux Supervisor to keep the Horizon process running and restart it if it crashes.
[program:horizon]
command=php /srv/app/artisan horizon
autorestart=true
stdout_logfile=/var/log/horizon.logPausing and Continuing
Pause Horizon during deployments to drain the queue gracefully, then continue.
$ php artisan horizon:pause
$ php artisan horizon:continue
$ php artisan horizon:terminateSummary
Horizon replaces queue workers with a single process + beautiful dashboard. Configure worker counts in config/horizon.php. Use Supervisor in production to keep Horizon alive.
Quick Check
Which command starts Laravel Horizon?
Frequently asked questions
Is the “Monitoring Queues with Laravel Horizon” lesson free?
Yes — the full text of “Monitoring Queues with Laravel Horizon” is free to read here on the web, and the PHP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the PHP Academy course, upgrade to CoddyKit PRO.
What will I learn in “Monitoring Queues with Laravel Horizon”?
Install Horizon and observe queue throughput and failed jobs. You practise PHP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start PHP Academy?
No prior experience is required. PHP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Monitoring Queues with Laravel Horizon” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this PHP Academy lesson?
Yes. Every PHP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Queue Concepts and Drivers
- Creating and Dispatching Jobs
- Job Retries, Delays, and Chaining
- Monitoring Queues with Laravel Horizon