PHPackages                             smskin/laravel-dynamic-horizon - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. smskin/laravel-dynamic-horizon

ActiveLibrary[Queues &amp; Workers](/categories/queues)

smskin/laravel-dynamic-horizon
==============================

Dynamic supervisors\\queues for laravel horizon

1.0.0(1y ago)1150↓25%[1 PRs](https://github.com/smskin/laravel-dynamic-horizon/pulls)MITPHPPHP ^8.0CI passing

Since Sep 20Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/smskin/laravel-dynamic-horizon)[ Packagist](https://packagist.org/packages/smskin/laravel-dynamic-horizon)[ RSS](/packages/smskin-laravel-dynamic-horizon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

Dynamic Management of Horizon Supervisors
-----------------------------------------

[](#dynamic-management-of-horizon-supervisors)

I encountered the need to programmatically manage processes and queues in Horizon to solve the following case:

> My users generate tasks in the queue. If one user generates 1 million tasks, the second user has to wait until the queue is cleared. The standard Horizon solution will not work, as consumers and queues are configured statically in the configuration file. Creating X queues for each user would be a very resource-intensive solution since there are many users, and the queues will remain idle most of the time (each Horizon consumer is a separate process that consumes operating system resources).

Solution: Create consumers as needed and stop them when not in use.

### Operation Principle

[](#operation-principle)

The library is based on listening to the standard Horizon MasterSupervisorLooped event (the completion of the Horizon master process cycle).

At each tick of the cycle, the current configuration of dynamic supervisors (stored in Redis) is polled, and supervisors are started/stopped as necessary.

### Library Feature

[](#library-feature)

This library does not modify Horizon in any way. It is designed to "live alongside" and not interfere. When the configuration changes, it takes some time (the tick of the Horizon process) before new supervisors are launched.

### Usage

[](#usage)

1. Getting the list of dynamic supervisors

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;

$supervisors = (new DynamicHorizon())->getSupervisors();
```

2. Setting the configuration for supervisors

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;
use SMSkin\LaravelDynamicHorizon\Models\Supervisor;

(new DynamicHorizon())->setSupervisors(collect([
    new Supervisor(
        'user1-supervisor',
        [
            'user1-queue',
        ]
    ),
    new Supervisor(
        'user2-supervisor',
        [
            'user2-queue-1',
            'user2-queue-2',
        ]
    )
]))
```

[![set configuration screenshot](https://github.com/smskin/laravel-dynamic-horizon/raw/readme/screenshots/set.png)](https://github.com/smskin/laravel-dynamic-horizon/blob/readme/screenshots/set.png)

3. Adding a supervisor to the configuration

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;
use SMSkin\LaravelDynamicHorizon\Models\Supervisor;

(new DynamicHorizon())->addSupervisor(
    new Supervisor(
        'user3-supervisor',
        [
            'user3-queue',
        ]
    )
);
```

[![add supervisor screenshot](https://github.com/smskin/laravel-dynamic-horizon/raw/readme/screenshots/add.png)](https://github.com/smskin/laravel-dynamic-horizon/blob/readme/screenshots/add.png)

4. Updating the configuration of one of the supervisors

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;
use SMSkin\LaravelDynamicHorizon\Models\Supervisor;

(new DynamicHorizon())->updateSupervisor(
    new Supervisor(
        'user3-supervisor',
        [
            'user3-queue-1',
            'user3-queue-2',
        ]
    )
);
```

[![update supervisor screenshot](https://github.com/smskin/laravel-dynamic-horizon/raw/readme/screenshots/update.png)](https://github.com/smskin/laravel-dynamic-horizon/blob/readme/screenshots/update.png)

5. Stopping one of the supervisors

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;
use SMSkin\LaravelDynamicHorizon\Models\Supervisor;

(new DynamicHorizon())->stopSupervisor(
    new Supervisor(
        'user1-supervisor',
        [
            'user1-queue',
        ]
    )
);
```

[![stop supervisor screenshot](https://github.com/smskin/laravel-dynamic-horizon/raw/readme/screenshots/stop.png)](https://github.com/smskin/laravel-dynamic-horizon/blob/readme/screenshots/stop.png)

6. Stopping all dynamic supervisors

```
use SMSkin\LaravelDynamicHorizon\DynamicHorizon;

(new DynamicHorizon())->stopAllSupervisors();
```

[![stop all supervisors screenshot](https://github.com/smskin/laravel-dynamic-horizon/raw/readme/screenshots/stop_all.png)](https://github.com/smskin/laravel-dynamic-horizon/blob/readme/screenshots/stop_all.png)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance49

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

600d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92de9daad6e0c4ef7b8b4fa112373401ae79ac02d185653724ca4ac425add1b7?d=identicon)[smskin](/maintainers/smskin)

---

Top Contributors

[![smskin](https://avatars.githubusercontent.com/u/3227797?v=4)](https://github.com/smskin "smskin (7 commits)")

---

Tags

laravelqueuedynamichorizonsupervisor

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smskin-laravel-dynamic-horizon/health.svg)

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

###  Alternatives

[foxxmd/laravel-elasticbeanstalk-queue-worker

Deploy your Laravel application as a queue worker on AWS ElasticBeanstalk

5493.5k](/packages/foxxmd-laravel-elasticbeanstalk-queue-worker)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[renoki-co/horizon-exporter

Export Laravel Horizon metrics using this Prometheus exporter.

24152.7k](/packages/renoki-co-horizon-exporter)[pierophp/laravel-queue-manager

Laravel Queue Manager

182.4k](/packages/pierophp-laravel-queue-manager)

PHPackages © 2026

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