PHPackages                             j-sandaruwan/laravel-job-monitor - 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. j-sandaruwan/laravel-job-monitor

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

j-sandaruwan/laravel-job-monitor
================================

Laravel package for tracking queue jobs with status, progress, and detailed execution history

v1.0.1(3mo ago)010MITPHPPHP ^8.1|^8.2|^8.3

Since Jan 31Pushed 3mo agoCompare

[ Source](https://github.com/J-Sandaruwan/laravel-job-monitor)[ Packagist](https://packagist.org/packages/j-sandaruwan/laravel-job-monitor)[ RSS](/packages/j-sandaruwan-laravel-job-monitor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Laravel Job Monitor
===================

[](#laravel-job-monitor)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cdce3e2f5fc53c8d7bddacbd340d4db4351b2d393c5be5669e79efec88da26b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a2d73616e6461727577616e2f6c61726176656c2d6a6f622d6d6f6e69746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/j-sandaruwan/laravel-job-monitor)[![Total Downloads](https://camo.githubusercontent.com/21c7ac7279ea4b0234b171f7c008ca348b75030e89a8c7c72597f9537fb065e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a2d73616e6461727577616e2f6c61726176656c2d6a6f622d6d6f6e69746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/j-sandaruwan/laravel-job-monitor)

A lightweight Laravel package for tracking queue jobs with status, progress, execution history, and detailed error logging.

Features
--------

[](#features)

✅ **Automatic Job Tracking** - Zero configuration needed, works out of the box
✅ **Real-Time Progress** - Track job progress (0-100%) with simple trait
✅ **Detailed History** - Status, attempts, errors, start/finish times
✅ **REST API** - Pre-built endpoints for job listing, stats, and retry
✅ **Retry Failed Jobs** - One-click retry functionality
✅ **Configurable** - Flexible options for tracking, retention, and routes
✅ **Zero Dependencies** - No external monitoring services required

---

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

[](#installation)

Install the package via Composer:

```
composer require j-sandaruwan/laravel-job-monitor
```

### Publish Configuration &amp; Migrations

[](#publish-configuration--migrations)

```
php artisan vendor:publish --provider="JSandaruwan\LaravelJobMonitor\JobMonitorServiceProvider"
```

This publishes:

- `config/job-monitor.php` - Configuration file
- Migration: `create_job_histories_table.php`

### Run Migrations

[](#run-migrations)

```
php artisan migrate
```

---

Usage
-----

[](#usage)

### Basic Tracking (Automatic)

[](#basic-tracking-automatic)

All queue jobs are **automatically tracked** with no code changes needed! The package listens to Laravel's queue events and tracks:

- Job start/finish times
- Status (pending → processing → completed/failed)
- Attempt count
- Errors (if failed)
- Progress (0% → 100%)

### Progress Tracking (Manual)

[](#progress-tracking-manual)

To track job progress, add the `TracksJobProgress` trait to your job:

```
use JSandaruwan\LaravelJobMonitor\Traits\TracksJobProgress;
use Illuminate\Contracts\Queue\ShouldQueue;

class ProcessVideoJob implements ShouldQueue
{
    use TracksJobProgress;

    public function handle()
    {
        $this->updateProgress(10);  // 10% complete

        // Download video
        $this->updateProgress(30);

        // Process video
        $this->updateProgress(70);

        // Upload result
        $this->updateProgress(90);

        // Job completes → auto-set to 100%
    }
}
```

**Alternative Method:** Use `queueProgress()` for backward compatibility

```
$this->queueProgress(50);  // Same as updateProgress(50)
```

---

API Endpoints
-------------

[](#api-endpoints)

The package provides REST API endpoints for accessing job data:

### List All Jobs

[](#list-all-jobs)

```
GET /api/job-monitor/jobs?status=failed&per_page=50
```

**Query Parameters:**

- `search` - Search by job ID, class name, or error message
- `status` - Filter by status (pending, processing, completed, failed)
- `queue` - Filter by queue name
- `job_type` - Filter by job class name
- `date_from` - Filter jobs after this date
- `date_to` - Filter jobs before this date
- `per_page` - Items per page (default: 25)

### Get Single Job

[](#get-single-job)

```
GET /api/job-monitor/jobs/{id}
```

### Get Statistics

[](#get-statistics)

```
GET /api/job-monitor/jobs/stats
```

**Response:**

```
{
    "total_jobs": 1534,
    "pending_jobs": 12,
    "completed_jobs": 1480,
    "failed_jobs": 42,
    "total_runtime": 45230,
    "average_runtime": 29.5
}
```

### Retry Failed Job

[](#retry-failed-job)

```
POST /api/job-monitor/jobs/{id}/retry
```

---

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

[](#configuration)

Edit `config/job-monitor.php`:

```
return [
    // Database table name
    'table_name' => 'job_histories',

    // Enable/disable tracking
    'enabled' => true,

    // Track specific queues only (empty = all queues)
    'track_queues' => [],  // e.g., ['default', 'high-priority']

    // Skip specific job classes
    'skip_jobs' => [],  // e.g., ['App\Jobs\InternalJob']

    // Retention policy (days)
    'retention_days' => 30,  // null = keep forever

    // API routes configuration
    'route' => [
        'enabled' => true,
        'prefix' => 'api/job-monitor',
        'middleware' => ['api'],
    ],

    // Pagination
    'per_page' => 25,
];
```

### Environment Variables

[](#environment-variables)

```
JOB_MONITOR_ENABLED=true
JOB_MONITOR_TABLE=job_histories
JOB_MONITOR_RETENTION_DAYS=30
JOB_MONITOR_ROUTES_ENABLED=true
JOB_MONITOR_ROUTE_PREFIX=api/job-monitor
JOB_MONITOR_PER_PAGE=25
```

---

Frontend Integration
--------------------

[](#frontend-integration)

Build your own UI using the provided API endpoints. Example with Vue.js:

```

import { ref, onMounted } from "vue";
import axios from "axios";

const jobs = ref([]);

const fetchJobs = async () => {
    const { data } = await axios.get("/api/job-monitor/jobs");
    jobs.value = data.data;
};

const retryJob = async (jobId) => {
    await axios.post(`/api/job-monitor/jobs/${jobId}/retry`);
    fetchJobs(); // Refresh list
};

onMounted(fetchJobs);

        {{ job.job_class }}
        Status: {{ job.status }}

            Progress: {{ job.progress }}%

            Retry

```

---

Data Retention
--------------

[](#data-retention)

Clean up old job records automatically:

```
// In app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
    $retentionDays = config('job-monitor.retention_days', 30);

    if ($retentionDays) {
        $schedule->command('db:table', [
            'table' => config('job-monitor.table_name'),
            '--where' => "created_at < DATE_SUB(NOW(), INTERVAL {$retentionDays} DAY)"
        ])->daily();
    }
}
```

---

Testing
-------

[](#testing)

```
composer test
```

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

---

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.

---

Credits
-------

[](#credits)

- [J Sandaruwan](https://github.com/j-sandaruwan)
- [All Contributors](../../contributors)

---

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance81

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Every ~0 days

Total

2

Last Release

102d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60dabe7e3ca596a9335b96922af3a831bccc51c12c85b28ea849ff7b0ed7a6bd?d=identicon)[J-Sandaruwan](/maintainers/J-Sandaruwan)

---

Top Contributors

[![J-Sandaruwan](https://avatars.githubusercontent.com/u/34189753?v=4)](https://github.com/J-Sandaruwan "J-Sandaruwan (1 commits)")

---

Tags

laravelmonitoringtrackingqueuejobsprogressjob-monitor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/j-sandaruwan-laravel-job-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/j-sandaruwan-laravel-job-monitor/health.svg)](https://phpackages.com/packages/j-sandaruwan-laravel-job-monitor)
```

###  Alternatives

[storviaio/vantage

Vantage: Strategic queue monitoring and observability for Laravel applications.

2342.9k](/packages/storviaio-vantage)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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