PHPackages                             ashiqfardus/horizon-running-jobs - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. ashiqfardus/horizon-running-jobs

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

ashiqfardus/horizon-running-jobs
================================

Monitor currently running jobs in Laravel Horizon for distributed systems

v1.0.0(4mo ago)614MITPHPPHP ^8.0

Since Jan 7Pushed 4mo agoCompare

[ Source](https://github.com/ashiqfardus/laravel-horizon-running-jobs)[ Packagist](https://packagist.org/packages/ashiqfardus/horizon-running-jobs)[ RSS](/packages/ashiqfardus-horizon-running-jobs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Laravel Horizon Running Jobs
============================

[](#laravel-horizon-running-jobs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/583fcccfc2b41a213ea90199715e3e514534c1012f168bfaf6c5ea6aa7bb4903/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736869716661726475732f686f72697a6f6e2d72756e6e696e672d6a6f62732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashiqfardus/horizon-running-jobs)[![Total Downloads](https://camo.githubusercontent.com/22bfd908a5bcce1a624a5dd2110c274744f3a31be5492161a933bb946528f3af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736869716661726475732f686f72697a6f6e2d72756e6e696e672d6a6f62732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashiqfardus/horizon-running-jobs)[![License](https://camo.githubusercontent.com/1dee40fe5c936cc874e27762dd61aa13dc23947b483f4172f40350cc3bd121f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61736869716661726475732f686f72697a6f6e2d72756e6e696e672d6a6f62732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashiqfardus/horizon-running-jobs)

**Monitor currently running jobs in Laravel Horizon.**

Laravel Horizon shows pending, completed, and failed jobs—but not what's **currently running**. This package fills that gap for both single-server and distributed multi-server setups.

---

Features
--------

[](#features)

- 🔍 **Real-time Monitoring** - See jobs as they execute
- 🖥️ **CLI Command** - `php artisan horizon:running-jobs`
- 🌐 **HTTP API** - JSON endpoint for dashboards
- 🏢 **Multi-Server Support** - Filter by specific server or view all (distributed mode)
- ⏱️ **Duration Tracking** - See how long each job has been running
- 📊 **Statistics** - Aggregate stats by server, queue, and job class
- 💾 **Response Caching** - Configurable caching for high-traffic APIs

---

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

[](#requirements)

PackageVersions SupportedPHP8.0, 8.1, 8.2, 8.3, 8.4Laravel9.x, 10.x, 11.x, 12.xHorizon5.x, 6.xRedis6.0+---

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

[](#installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require ashiqfardus/horizon-running-jobs
```

### Step 2: Publish Configuration

[](#step-2-publish-configuration)

```
php artisan vendor:publish --tag=horizon-running-jobs-config
```

### Step 3: Choose Your Setup

[](#step-3-choose-your-setup)

#### 🖥️ Single Server Setup (Default)

[](#️-single-server-setup-default)

If you have **one application server** with Redis on the same or separate machine, no additional configuration is needed. The package works out of the box:

```
// config/horizon-running-jobs.php
'distributed' => false,  // Default - shows all running jobs
```

**That's it!** Just run:

```
php artisan horizon:running-jobs
```

#### 🌐 Distributed Setup (Multiple Servers)

[](#-distributed-setup-multiple-servers)

If you have **multiple application servers** sharing a Redis instance, enable distributed mode:

```
// config/horizon-running-jobs.php
'distributed' => true,
```

**Server identification depends on your `horizon.php` setup:**

##### Option A: Using `gethostname()` (Auto-detected ✅)

[](#option-a-using-gethostname-auto-detected-)

If your `horizon.php` uses `gethostname()` as the supervisor key:

```
// config/horizon.php
'defaults' => [
    gethostname() => [  // Each server has unique hostname
        'connection' => 'redis',
        'queue' => ['default'],
    ],
],
```

**No additional configuration needed** — each server automatically identifies itself by its hostname.

##### Option B: Using Static Names (Manual config required)

[](#option-b-using-static-names-manual-config-required)

If your `horizon.php` uses static supervisor names:

```
// config/horizon.php
'defaults' => [
    'supervisor-01' => [...],  // For Server 1
    'supervisor-02' => [...],  // For Server 2
],
```

You **must** tell each server which supervisor it is:

```
// On Server 1: config/horizon-running-jobs.php
'server_identifier' => 'supervisor-01',

// On Server 2: config/horizon-running-jobs.php
'server_identifier' => 'supervisor-02',
```

**Or use an environment variable** (recommended for deployment):

```
// config/horizon-running-jobs.php
'server_identifier' => env('HORIZON_SUPERVISOR_NAME'),
```

Then set in `.env` on each server:

```
# Server 1
HORIZON_SUPERVISOR_NAME=supervisor-01

# Server 2
HORIZON_SUPERVISOR_NAME=supervisor-02
```

---

**Then** add the `TracksServer` trait to your job classes:

```
