PHPackages                             iivannov/elegant-laravel-worker - 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. iivannov/elegant-laravel-worker

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

iivannov/elegant-laravel-worker
===============================

Elegant way to gracefully handle SIGTERM signal in Laravel queue worker

1.0.0(9y ago)24.0kMITPHPPHP &gt;=5.6.4

Since Feb 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/iivannov/elegant-laravel-worker)[ Packagist](https://packagist.org/packages/iivannov/elegant-laravel-worker)[ RSS](/packages/iivannov-elegant-laravel-worker/feed)WikiDiscussions master Synced 2mo ago

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

Elegant Laravel Worker for Laravel 5.3
======================================

[](#elegant-laravel-worker-for-laravel-53)

Elegant way to gracefully handle SIGTERM signal in Laravel 5.3 queue worker. In Laravel &gt;=5.4 this issue is beautifully handled.
-----------------------------------------------------------------------------------------------------------------------------------

[](#elegant-way-to-gracefully-handle-sigterm-signal-in-laravel-53-queue-workerin-laravel-54-this-issue-is-beautifully-handled)

Install
-------

[](#install)

Via Composer

```
$ composer require iivannov/elegant-laravel-worker
```

Register in Laravel
-------------------

[](#register-in-laravel)

To replace the default Queue Worker with this one, you need to add the ElegantWorkerServiceProvider class to the providers array in your `config\app.php`

```
'providers' => [
    ...
    Iivannov\ElegantWorker\ElegantWorkerServiceProvider::class,
];
```

Use Case
--------

[](#use-case)

Gracefully stop a Queue Worker by using SIGTERM signal.

### Why would I stop the Worker?

[](#why-would-i-stop-the-worker)

There are many cases that will require to restart the worker.

- start/stop workers when auto-scaling
- temporarily stop the execution of tasks
- reloading supervisor (or another monitoring tool) configuration

### Default Laravel Behaviour:

[](#default-laravel-behaviour)

When SIGTERM is received by the Worker it interrupts immediately the currently processed job, which may break your application by not letting the job finish leading to unexpected results.

### Elegant Behaviour:

[](#elegant-behaviour)

When SIGTERM is received by the Worker it will wait for the currently processed job to finish and then will exit gracefully.

### What do we solve?

[](#what-do-we-solve)

- Interrupting long running jobs executing consecutive interrelated tasks
- Interrupting in the middle of a DB transaction causing a deadlock
- Prevent repeating the execution of a an interrupted job when it is picked up again by a Worker

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

3365d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7932620?v=4)[Ivan Ivanov](/maintainers/iivannov)[@iivannov](https://github.com/iivannov)

---

Tags

phplaravelsigtermqueueworkerdeadlock

### Embed Badge

![Health badge](/badges/iivannov-elegant-laravel-worker/health.svg)

```
[![Health](https://phpackages.com/badges/iivannov-elegant-laravel-worker/health.svg)](https://phpackages.com/packages/iivannov-elegant-laravel-worker)
```

###  Alternatives

[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3105.7M](/packages/dusterio-laravel-aws-worker)[foxxmd/laravel-elasticbeanstalk-queue-worker

Deploy your Laravel application as a queue worker on AWS ElasticBeanstalk

5493.5k](/packages/foxxmd-laravel-elasticbeanstalk-queue-worker)[renoki-co/horizon-exporter

Export Laravel Horizon metrics using this Prometheus exporter.

24152.7k](/packages/renoki-co-horizon-exporter)[webparking/laravel-queue-ensurer

This composer package provides a Laravel queue ensurer.

6416.1k](/packages/webparking-laravel-queue-ensurer)

PHPackages © 2026

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