PHPackages                             palpalani/laravel-sqs-queue-json-reader - 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. palpalani/laravel-sqs-queue-json-reader

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

palpalani/laravel-sqs-queue-json-reader
=======================================

Custom SQS queue reader for Laravel

0.6.0(3mo ago)29127.4k↓41.7%8[1 issues](https://github.com/palpalani/laravel-sqs-queue-json-reader/issues)[1 PRs](https://github.com/palpalani/laravel-sqs-queue-json-reader/pulls)MITPHPPHP ^8.2CI passing

Since Jan 13Pushed 1w ago2 watchersCompare

[ Source](https://github.com/palpalani/laravel-sqs-queue-json-reader)[ Packagist](https://packagist.org/packages/palpalani/laravel-sqs-queue-json-reader)[ Docs](https://github.com/palpalani/laravel-sqs-queue-json-reader)[ GitHub Sponsors](https://github.com/sponsors/palpalani)[ RSS](/packages/palpalani-laravel-sqs-queue-json-reader/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (24)Versions (51)Used By (0)

Custom SQS queue reader for Laravel
===================================

[](#custom-sqs-queue-reader-for-laravel)

 [![Custom SQS queue reader for Laravel](https://repository-images.githubusercontent.com/329289269/bf372113-a004-40f2-815b-300155f7a220)](https://repository-images.githubusercontent.com/329289269/bf372113-a004-40f2-815b-300155f7a220)

The Laravel SQS Queue Reader is a powerful extension designed to seamlessly integrate external webhooks into your Laravel application. By leveraging the reliability and scalability of Amazon Simple Queue Service (SQS), this extension ensures that your application efficiently processes incoming webhooks, minimizing downtime and enhancing overall performance.

### Key Features:

[](#key-features)

#### Effortless Webhook Integration:

[](#effortless-webhook-integration)

Easily integrate external webhooks into your Laravel application without compromising on performance.

#### Queue-Based Processing:

[](#queue-based-processing)

Harness the power of Amazon SQS to queue incoming webhooks, allowing for asynchronous and parallel processing, ensuring optimal response times.

#### Reliability and Scalability:

[](#reliability-and-scalability)

SQS provides a robust and scalable infrastructure, ensuring that your application can handle varying webhook loads without compromising on stability.

#### Seamless Laravel Integration:

[](#seamless-laravel-integration)

Designed as a Laravel extension, the Webhook Queue Reader seamlessly integrates into your Laravel project, following Laravel's coding standards and conventions.

#### Configurable Settings:

[](#configurable-settings)

Customize the extension's settings to align with your application's requirements, including queue names, visibility timeout, and other SQS-specific configurations.

#### Detailed Logging:

[](#detailed-logging)

Gain insights into the webhook processing flow with detailed logging, helping you troubleshoot and monitor the system effectively.

### How It Works:

[](#how-it-works)

#### Webhook Registration:

[](#webhook-registration)

Register external webhooks with your Laravel application by providing the webhook URL.

#### SQS Queue Integration:

[](#sqs-queue-integration)

Incoming webhooks are efficiently processed through the SQS queue, ensuring optimal handling of webhook payloads.

#### Asynchronous Processing:

[](#asynchronous-processing)

Leverage the asynchronous processing capabilities of SQS to handle webhooks in the background, preventing any impact on your application's response times.

#### Automatic Retries:

[](#automatic-retries)

Benefit from SQS's automatic retries, ensuring that failed webhook processing attempts are retried without manual intervention.

[![Latest Version on Packagist](https://camo.githubusercontent.com/70942c3dc9cf64db55039e9306d684fc9f0446cbf777a84a60e1884e62dbbc2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70616c70616c616e692f6c61726176656c2d7371732d71756575652d6a736f6e2d7265616465722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/palpalani/laravel-sqs-queue-json-reader)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3191105b2f6c93ed7af39841a795f8925f3da211d5831c60a67280a70f0e47c9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c70616c616e692f6c61726176656c2d7371732d71756575652d6a736f6e2d7265616465722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666f722d7468652d6261646765)](https://github.com/palpalani/laravel-sqs-queue-json-reader/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3e2cc6a181df8f67f64f19f1b26958b897ea9abe994fd302e2b547422123fb76/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c70616c616e692f6c61726176656c2d7371732d71756575652d6a736f6e2d7265616465722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666f722d7468652d6261646765)](https://github.com/palpalani/laravel-sqs-queue-json-reader/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/cfae4f2c39d8a551ee5e0fc25a3a52af7a1afa807c11d1d42e787be5bc083b98/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70616c70616c616e692f6c61726176656c2d7371732d71756575652d6a736f6e2d7265616465722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/palpalani/laravel-sqs-queue-json-reader)[![Laravel v10.x](https://camo.githubusercontent.com/bfea501efe5759f52cfebee79ebb907199c9e88ae0bd65948d40ba67a1ad73fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d7631302e782d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c)](https://laravel.com)

[![PHP 8.1](https://camo.githubusercontent.com/f828b436a9f10bce9f30864883ab5b07c5f9bd5e21bf275312ad61f37dedce3b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://php.net)

Custom SQS queue reader for Laravel projects that supports raw JSON payloads and reads multiple messages. Laravel expects SQS messages to be generated in a specific format that includes job handler class and a serialized job.

Note: Implemented to read multiple messages from queue.

This library is very useful when you want to parse messages from 3rd party applications such as stripe webhooks, shopify webhooks, mailgun web hooks, custom JSON messages and so on.

Getting Started
---------------

[](#getting-started)

Install Custom SQS queue reader for Laravel via composer:

```
composer require palpalani/laravel-sqs-queue-json-reader
```

You can publish the config file and Configure your SQS settings in the Laravel configuration file.

```
php artisan vendor:publish --provider="palPalani\SqsQueueReader\SqsQueueReaderServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
/**
 * List of plain SQS queues and their corresponding handling classes
 */
return [

    // Separate queue handler with corresponding queue name as key.
    'handlers' => [
        'stripe-webhooks' => [
            'class' => App\Jobs\StripeHandler::class,
            'count' => 10,
        ],
        'mailgun-webhooks' => [
            'class' => App\Jobs\MailgunHandler::class,
            'count' => 10,
        ]
    ],

    // If no handlers specified then default handler will be executed.
    'default-handler' => [

        // Name of the handler class
        'class' => App\Jobs\SqsHandler::class,

        // Number of messages need to read from SQS.
        'count' => 1,
    ]
];
```

If the queue is not found in 'handlers' array, SQS payload is passed to default handler.

Register your webhooks with your Laravel application.

Add `sqs-json` connection to your config/queue.php, Example:

```
    [
        // Add new SQS connection
        'sqs-json' => [
            'driver' => 'sqs-json',
            'key'    => env('AWS_ACCESS_KEY_ID', ''),
            'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
            'prefix' => env('AWS_SQS_PREFIX', 'https://sqs.us-west-2.amazonaws.com/1234567890'),
            'queue'  => env('AWS_SQS_QUEUE', 'external-webhooks'),
            'region' => env('AWS_DEFAULT_REGION', 'us-west-2'),
        ],
    ]
```

In your .env file, choose sqs-json as your new default queue driver:

```
QUEUE_DRIVER=sqs-json

```

Enjoy seamless, reliable, and scalable webhook processing!

Dispatching to SQS
------------------

[](#dispatching-to-sqs)

If you plan to push plain messages from Laravel, you can rely on DispatcherJob:

```
use palPalani\SqsQueueReader\Jobs\DispatcherJob;

class ExampleController extends Controller
{
    public function index()
    {
        // Dispatch job with some data.
        $job = new DispatcherJob([
            'music' => 'Ponni nathi from PS-1',
            'singer' => 'AR. Rahman',
            'time' => time()
        ]);

        // Dispatch the job as you normally would
        // By default, your data will be encapsulated in 'data' and 'job' field will be added
        $this->dispatch($job);

        // If you wish to submit a true plain JSON, add setPlain()
        $this->dispatch($job->setPlain());
    }
}
```

Above code will push the following JSON object to SQS queue:

```
{"job":"App\\Jobs\\SqsHandler@handle","data":{"music":"Sample SQS message","singer":"AR. Rahman","time":1464511672}}
```

'job' field is not used, actually. It's just kept for compatibility with Laravel Framework.

### Processing job

[](#processing-job)

Run the following commnd for testing the dispatched job.

`php artisan queue:work sqs-json`

For `production`, use supervisor with the following configuration.

```
[program:sqs-json-reader]
process_name=%(program_name)s_%(process_num)02d
command=php /var/html/app/artisan queue:work sqs-json --sleep=60 --timeout=10 --tries=2 --memory=128 --daemon
directory=/var/html/app
autostart=true
autorestart=true
startretries=10
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/var/html/app/horizon.log
stderr_logfile=/tmp/horizon-error.log
stopwaitsecs=3600
priority=1000

```

If you are using multiple connection, then duplicate above supervisor configutation and change the connection name.

### Receiving from SQS

[](#receiving-from-sqs)

If a 3rd-party application or API Gateway to SQS implementation is creating custom-format JSON messages, just add a handler in the config file and implement a handler class as follows:

```
use Illuminate\Contracts\Queue\Job as LaravelJob;

class SqsHandlerJob extends Job
{
    /**
     * @var null|array $data
     */
    protected $data;

    /**
     * @param LaravelJob $job
     * @param null|array $data
     */
    public function handle(LaravelJob $job, ?array $data): void
    {
        // This is incoming JSON payload, already decoded to an array
        var_dump($data);

        // Raw JSON payload from SQS, if necessary
        var_dump($job->getRawBody());
    }
}
```

Note:

Ensure that your Laravel application is configured with the necessary AWS credentials and permissions to interact with SQS.

Enhance your Laravel application's webhook processing capabilities with the Laravel Webhook Queue Reader. Efficient, reliable, and designed for optimal performance!

For more information about AWS SQS check [offical docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-queue-parameters.html).

Testing
-------

[](#testing)

We already configured the script, just run the command:

```
composer test
```

For test coverage format, run the command:

```
composer test-coverage
```

For code analyse, run the command:

```
composer analyse
```

For code format, run the command:

```
composer format
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

If you want to contribute, then you may want to test it in a real Laravel project:

- Fork this repository to your GitHub account.
- Create a Laravel app locally.
- Clone your fork in your Laravel app's root directory.
- In the `/laravel-sqs-queue-json-reader` directory, create a branch for your fix, e.g. `feature/awesome-feature`.

Install the packages in your app's `composer.json`:

```
{
    // ...
    "require": {
        "palpalani/laravel-sqs-queue-json-reader": "*",
    },
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "path",
            "url": "path/to/location"
        }
    ],
    // ...
}
```

Now, run `composer update`.

Other Laravel packages
----------------------

[](#other-laravel-packages)

[GrumPHP rector task](https://github.com/palpalani/grumphp-rector-task) GrumPHP with a task that runs [RectorPHP](https://github.com/rectorphp/rector-src) for your Laravel projects.

[Email Deny List (blacklist) Check - IP Deny List (blacklist) Check](https://github.com/palpalani/laravel-dns-deny-list-check) Deny list (blacklist) checker will test a mail server IP address against over 50 DNS based email blacklists. (Commonly called Realtime blacklist, DNSBL or RBL).

[Spamassassin spam score of emails](https://github.com/palpalani/laravel-spamassassin-score) Checks the spam score of email contents using spamassassin database.

[Laravel Login Notifications](https://github.com/palpalani/laravel-login-notifications) A login event notification for Laravel projects. By default, it will send notification only on production environment only.

[Laravel Toastr](https://github.com/palpalani/laravel-toastr) Implements toastr.js for Laravel. Toastr.js is a Javascript library for non-blocking notifications.

[Beast](https://github.com/palpalani/beast) Beast is Screenshot as a Service using Nodejs, Chrome and Aws Lamda. Convert a webpage to an image using headless Chrome Takes screenshot of any given URL/Html content and returns base64 encoded buffer.

[eCommerce Product Recommendations](https://github.com/palpalani/eCommerce-Product-Recommendations) Analyse order history of customers and recommend products for new customers which enables higher sales volume.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [palPalani](https://github.com/palPalani)
- [All Contributors](../../contributors)

Need Help?
----------

[](#need-help)

If you spot a bug or have a question or feature request, please [submit a detailed issue](https://github.com/palpalani/laravel-sqs-queue-json-reader/issues), and wait for assistance.

License
-------

[](#license)

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

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 74.4% 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 ~39 days

Recently: every ~213 days

Total

49

Last Release

104d ago

PHP version history (4 changes)0.1.0PHP ^7.4|^8.0

0.2.0PHP ^8.0

0.4.0PHP ^8.1

0.5.3PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/716695?v=4)[Palaniappan P](/maintainers/palpalani)[@palpalani](https://github.com/palpalani)

---

Top Contributors

[![palpalani](https://avatars.githubusercontent.com/u/716695?v=4)](https://github.com/palpalani "palpalani (131 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (40 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![bseyb](https://avatars.githubusercontent.com/u/787542?v=4)](https://github.com/bseyb "bseyb (1 commits)")[![sword](https://avatars.githubusercontent.com/u/205181?v=4)](https://github.com/sword "sword (1 commits)")[![thamaraiselva](https://avatars.githubusercontent.com/u/26427735?v=4)](https://github.com/thamaraiselva "thamaraiselva (1 commits)")

---

Tags

laravellaravel-queuephp-librarysqs-clientpalpalanilaravel-sqs-queue-json-readersqs-readersqs-jsonsqs-text-readersqs-plain-messagesqs-bulk-messagelaravel-sqs

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/palpalani-laravel-sqs-queue-json-reader/health.svg)

```
[![Health](https://phpackages.com/badges/palpalani-laravel-sqs-queue-json-reader/health.svg)](https://phpackages.com/packages/palpalani-laravel-sqs-queue-json-reader)
```

###  Alternatives

[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M209](/packages/illuminate-broadcasting)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k55.0M618](/packages/laravel-scout)[illuminate/notifications

The Illuminate Notifications package.

513.1M1.1k](/packages/illuminate-notifications)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[illuminate/events

The Illuminate Events package.

13557.0M2.1k](/packages/illuminate-events)

PHPackages © 2026

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