PHPackages                             huangdijia/laravel-horizon-restart - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. huangdijia/laravel-horizon-restart

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

huangdijia/laravel-horizon-restart
==================================

Horizon Restart for Laravel.

v3.1.0(1y ago)22105.9k↓54.7%2MITPHPPHP &gt;=8.1CI failing

Since Sep 19Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/huangdijia/laravel-horizon-restart)[ Packagist](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[ Docs](https://github.com/huangdijia/laravel-horizon-restart)[ Fund](https://hdj.me/sponsors/)[ GitHub Sponsors](https://github.com/huangdijia)[ RSS](/packages/huangdijia-laravel-horizon-restart/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (8)Dependencies (9)Versions (24)Used By (0)

Laravel Horizon Restart
=======================

[](#laravel-horizon-restart)

[![Latest Test](https://github.com/huangdijia/laravel-horizon-restart/workflows/tests/badge.svg)](https://github.com/huangdijia/laravel-horizon-restart/actions)[![Latest Stable Version](https://camo.githubusercontent.com/64547d263281bffebbf1ec24d815f061d902e2e88e984e15ced82310fbbe5e5b/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f76)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[![Total Downloads](https://camo.githubusercontent.com/714a4d3f13a8abb97fab2a1675321d055e63daf564d539a8e207c3d374621fde/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f646f776e6c6f616473)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[![Monthly Downloads](https://camo.githubusercontent.com/8c4328387519b20f7f7f60be6757f543b422f07959b133aa9b2faef0d63cf3fa/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f642f6d6f6e74686c79)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[![Daily Downloads](https://camo.githubusercontent.com/6e95e9777979f3eb06deaf2488bf1a90093cc63af879afa2b6b1d876e359a221/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f642f6461696c79)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[![License](https://camo.githubusercontent.com/3855aa998b284d5622a8c6cae684b54b30af72521fa8cce392b940334b7c7e2d/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f6c6963656e7365)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)[![PHP Version Require](https://camo.githubusercontent.com/4d4390b98eab8ed83fcb2220e06ef8c02377e1c52fa2d53d277c30940140c6a2/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f6c61726176656c2d686f72697a6f6e2d726573746172742f726571756972652f706870)](https://packagist.org/packages/huangdijia/laravel-horizon-restart)

[中文文档](README_CN.md)

A Laravel package that extends Laravel Horizon with the ability to restart supervisors across multiple servers, similar to `php artisan queue:restart` but specifically designed for Horizon workers.

Features
--------

[](#features)

- 🚀 Restart all Horizon supervisors across multiple servers with a single command
- 🔄 Graceful termination of workers similar to `queue:restart`
- 📦 Automatic service provider registration
- 🎯 Works seamlessly with Horizon's queue distribution
- ⚡ Zero downtime deployments for Horizon workers

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.x or 12.x
- Laravel Horizon 5.x or 6.x

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require huangdijia/laravel-horizon-restart
```

The service provider will be automatically registered.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To restart all Horizon supervisors across all servers:

```
php artisan horizon:restart
```

This command will:

1. Discover all running Horizon supervisors
2. Dispatch a restart job to each supervisor's queue
3. Gracefully terminate each supervisor (similar to `horizon:terminate`)
4. Horizon will automatically restart the supervisors

### How It Works

[](#how-it-works)

When you run `horizon:restart`, the package:

1. **Discovers Supervisors**: Queries the Horizon master supervisor repository to find all active supervisors
2. **Dispatches Jobs**: Creates a `HorizonRestartJob` for each supervisor and dispatches it to that supervisor's queue
3. **Executes Termination**: Each job runs on its respective server and calls `horizon:terminate` locally
4. **Auto Restart**: Horizon's process monitoring automatically restarts terminated supervisors

This approach ensures that:

- All servers receive the restart signal
- Workers finish their current jobs before terminating
- No jobs are lost during the restart process
- Each server restarts independently

Use Cases
---------

[](#use-cases)

This package is particularly useful for:

- **Multi-Server Deployments**: When you have Horizon running on multiple servers and need to restart all of them
- **Code Deployments**: After deploying new code, restart all workers across all servers
- **Configuration Changes**: When Horizon configuration changes and all workers need to reload
- **Memory Management**: Periodic restarts to clear memory leaks or reset worker state

Configuration
-------------

[](#configuration)

The package automatically configures a special supervisor for handling restart jobs. No manual configuration is required.

The restart supervisor is automatically configured with:

- Connection: Uses the same connection as your first Horizon environment
- Queue: Uses Horizon's internal queue name
- Processes: 1 worker to handle restart jobs
- Tries: 3 attempts per job

Comparison with Other Methods
-----------------------------

[](#comparison-with-other-methods)

MethodSingle ServerMultiple ServersGraceful`horizon:terminate`✅❌✅`queue:restart`✅✅✅`horizon:restart` (this package)✅✅✅Development
-----------

[](#development)

### Testing

[](#testing)

Run the test suite:

```
composer test
```

### Code Style

[](#code-style)

Fix code style issues:

```
composer cs-fix
```

### Static Analysis

[](#static-analysis)

Run static analysis:

```
composer analyse
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Credits
-------

[](#credits)

- [huangdijia](https://github.com/huangdijia)
- [All Contributors](https://github.com/huangdijia/laravel-horizon-restart/contributors)

Links
-----

[](#links)

- [Documentation](https://github.com/huangdijia/laravel-horizon-restart/blob/main/README.md)
- [Packagist](https://packagist.org/packages/huangdijia/laravel-horizon-restart)
- [GitHub](https://github.com/huangdijia/laravel-horizon-restart)

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance62

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 87.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~133 days

Total

23

Last Release

492d ago

Major Versions

1.1.2 → v2.0.02022-09-28

v1.1.3 → v2.1.02023-01-09

v2.1.1 → v3.0.0-beta.12023-09-10

1.x-dev → v3.0.02024-03-08

PHP version history (3 changes)1.0.0PHP &gt;=7.1.0

v2.0.0PHP &gt;=8.0

v3.0.0-beta.1PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8337659?v=4)[Deeka Wong](/maintainers/huangdijia)[@huangdijia](https://github.com/huangdijia)

---

Top Contributors

[![huangdijia](https://avatars.githubusercontent.com/u/8337659?v=4)](https://github.com/huangdijia "huangdijia (65 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (5 commits)")[![kyranb](https://avatars.githubusercontent.com/u/5426926?v=4)](https://github.com/kyranb "kyranb (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")

---

Tags

laravelhorizon

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/huangdijia-laravel-horizon-restart/health.svg)

```
[![Health](https://phpackages.com/badges/huangdijia-laravel-horizon-restart/health.svg)](https://phpackages.com/packages/huangdijia-laravel-horizon-restart)
```

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k43.2M630](/packages/spatie-laravel-medialibrary)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[livewire/flux

The official UI component library for Livewire.

9527.8M127](/packages/livewire-flux)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[illuminate/events

The Illuminate Events package.

13557.0M2.1k](/packages/illuminate-events)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
