smitmartijn/laravel-pausable-jobs

Pause and resume Laravel jobs individually, instead of having to pause the entire queue.

Maintainers

Package info

github.com/smitmartijn/laravel-pausable-jobs

pkg:composer/smitmartijn/laravel-pausable-jobs

Statistics

Installs: 2 940

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

v1.2.0 2026-04-09 08:13 UTC

This package is auto-updated.

Last update: 2026-04-09 08:15:22 UTC


README

Pause and resume individual Laravel job classes without stopping your entire queue. Imagine you have a ton of queue jobs running, and you need to do maintenance on a part of the application, and only a select few jobs touch that part of the application.

Being able to pause specific job classes will let you run your maintenance without slowing down the rest of the application jobs.

Features

  • Pause/resume individual job classes
  • Works with multiple queue workers
  • Redis or Cache driver support to store pause states
  • Optional logging of pause/resume actions
  • Compatible with Laravel Horizon
  • No impact on other running jobs
  • Gradual backoff for paused job retries (configurable delays)
  • Configurable max retry time before a paused job is marked as failed

Installation

composer require smitmartijn/laravel-pausable-jobs

php artisan vendor:publish --tag=pausable-jobs-config

Usage

  1. Add the trait to your job:
use Smitmartijn\PausableJobs\Concerns\PausableJob;

class ProcessVideoJob implements ShouldQueue
{
    use PausableJob;

    public function handle()
    {
        // Your job logic
    }
}
  1. Control job execution:
use App\Jobs\ProcessVideoJob;
use Smitmartijn\PausableJobs\Facades\JobPause;

// Pause ProcessVideoJob
JobPause::pauseJobClass(ProcessVideoJob::class);

// Resume ProcessVideoJob
JobPause::resumeJobClass(ProcessVideoJob::class);

// Check status
if (JobPause::isPaused(ProcessVideoJob::class)) {
    // Job is paused
}

Configuration

config/pausable-jobs.php:

return [
    // Use the 'redis' or 'cache' driver - this is where the job pause state is stored
    'driver' => env('PAUSABLE_JOBS_DRIVER', 'redis'),
    // Backoff delays (in seconds) between retries while a job is paused.
    // Works like Laravel's $backoff property: each entry is used in order,
    // and the last value repeats for all subsequent retries.
    'backoff' => [30, 60, 90, 120, 300],
    // The maximum number of seconds a job can be retried before it is marked as failed
    'max_retry_time' => env('PAUSABLE_JOBS_MAX_RETRY_TIME', 3600),
    // Logging configuration, which will log when a job is retried because its paused
    'logging' => [
        'enabled' => env('PAUSABLE_JOBS_LOGGING', true),
        'channel' => env('PAUSABLE_JOBS_LOG_CHANNEL', 'stack'),
    ],
];

Pause State Manager with Filament v3

I've included an example Filament v3 widget that you can use to get an overview of all pausable jobs, and easily pause and resume them. Find more information in examples/FilamentWidgetExample. Here's what it looks like:

Filament Widget Example

Requirements

  • PHP 8.1+
  • Laravel 10+
  • Redis (optional)

License

MIT License (MIT). Please see License File for more information.

Support me

If you've found this package useful and want to support my work, feel free to look at purchasing one of my paid products listed on lostdomain.org. You can also find me on Bluesky 😊