PHPackages                             sumaiazaman/laravel-sqs-redrive - 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. sumaiazaman/laravel-sqs-redrive

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

sumaiazaman/laravel-sqs-redrive
===============================

Native AWS SQS dead letter queue (DLQ) support for Laravel. Automatically detects redrive policies, aligns retry counts with maxReceiveCount, and lets SQS handle failed job routing.

v1.0.0(3mo ago)00MITPHPPHP ^8.2CI failing

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/sumaiazaman/laravel-sqs-redrive)[ Packagist](https://packagist.org/packages/sumaiazaman/laravel-sqs-redrive)[ RSS](/packages/sumaiazaman-laravel-sqs-redrive/feed)WikiDiscussions main Synced 4w ago

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

Laravel SQS Redrive
===================

[](#laravel-sqs-redrive)

Native AWS SQS dead letter queue (DLQ) support for Laravel.

When an SQS queue has a [redrive policy](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) configured, this package automatically:

- **Detects the redrive policy** from SQS and caches it per queue URL
- **Aligns Laravel's retry count** with SQS `maxReceiveCount`
- **Skips message deletion on failure** so SQS natively routes failed messages to the dead letter queue

The Problem
-----------

[](#the-problem)

Laravel's default SQS driver deletes messages from SQS immediately after a job fails. This bypasses SQS's native dead letter queue routing entirely — failed messages never reach your DLQ.

```
Job fails → Laravel calls deleteMessage → Message gone → DLQ never receives it

```

The Solution
------------

[](#the-solution)

This package lets SQS handle the routing:

```
Job fails → Message stays in queue → SQS increments receive count → After maxReceiveCount, SQS moves to DLQ

```

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

[](#installation)

```
composer require sumaiazaman/laravel-sqs-redrive
```

The package auto-discovers the service provider.

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

[](#configuration)

In your `config/queue.php`, add a new connection using the `sqs-redrive` driver:

```
'connections' => [

    'sqs-redrive' => [
        'driver' => 'sqs-redrive',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
        'queue' => env('SQS_QUEUE', 'default'),
        'suffix' => env('SQS_SUFFIX'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

],
```

Then set your default queue connection:

```
QUEUE_CONNECTION=sqs-redrive
```

That's it. No other configuration needed — the package reads the redrive policy directly from SQS.

How It Works
------------

[](#how-it-works)

### 1. Automatic Redrive Policy Detection

[](#1-automatic-redrive-policy-detection)

When a job is popped from the queue, the package fetches and caches the queue's redrive policy via the SQS `getQueueAttributes` API. The result is cached for the lifetime of the worker process.

### 2. Retry Count Alignment

[](#2-retry-count-alignment)

If a redrive policy exists, `maxTries()` returns `maxReceiveCount` from the policy. This keeps Laravel's retry logic in sync with SQS — no more conflicts between Laravel's `$tries` and SQS's receive count.

### 3. Smart Deletion

[](#3-smart-deletion)

- **Successful jobs**: Deleted from SQS normally
- **Failed jobs without DLQ**: Deleted from SQS normally (same as default behavior)
- **Failed jobs with DLQ**: Skipped deletion — SQS handles routing to DLQ

API
---

[](#api)

The `SqsRedriveJob` class provides additional methods:

```
// Check if the queue has a dead letter queue configured
$job->hasDeadLetterQueue(); // bool

// Get the full redrive policy
$job->getRedrivePolicy(); // ['maxReceiveCount' => 3, 'deadLetterTargetArn' => '...']

// maxTries() automatically uses maxReceiveCount when DLQ is configured
$job->maxTries(); // 3
```

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

[](#requirements)

- PHP 8.2+
- Laravel 12.x or 13.x
- AWS SQS with a redrive policy configured

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

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

92d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/80034544?v=4)[sumaia161](/maintainers/sumaia161)[@Sumaia161](https://github.com/Sumaia161)

---

Top Contributors

[![sumaiazaman](https://avatars.githubusercontent.com/u/45918347?v=4)](https://github.com/sumaiazaman "sumaiazaman (2 commits)")

---

Tags

awsdead-letter-queuelaravelphpqueuesqslaravelawsqueuesqsdlqdead-letter-queueredrive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sumaiazaman-laravel-sqs-redrive/health.svg)

```
[![Health](https://phpackages.com/badges/sumaiazaman-laravel-sqs-redrive/health.svg)](https://phpackages.com/packages/sumaiazaman-laravel-sqs-redrive)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M292](/packages/laravel-horizon)[dusterio/laravel-aws-worker

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

3115.9M](/packages/dusterio-laravel-aws-worker)[shiftonelabs/laravel-sqs-fifo-queue

Adds a Laravel queue driver for Amazon SQS FIFO queues.

1556.7M4](/packages/shiftonelabs-laravel-sqs-fifo-queue)[joblocal/laravel-sqs-sns-subscription-queue

A simple Laravel service provider which adds a new queue connector to handle SNS subscription queues.

48459.0k](/packages/joblocal-laravel-sqs-sns-subscription-queue)[pod-point/laravel-aws-pubsub

A Laravel broadcasting driver and queue driver that broadcasts and listens to published events utilising AWS SNS, EventBridge and SQS.

10100.3k](/packages/pod-point-laravel-aws-pubsub)

PHPackages © 2026

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