PHPackages                             friendsofcat/laravel-plain-sqs - 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. [API Development](/categories/api)
4. /
5. friendsofcat/laravel-plain-sqs

ActiveLibrary[API Development](/categories/api)

friendsofcat/laravel-plain-sqs
==============================

Custom SQS connector for Laravel that supports custom format JSON

1.0.0(3y ago)02.7kMITPHPPHP &gt;=5.5.0

Since Mar 8Pushed 3y agoCompare

[ Source](https://github.com/friendsofcat/laravel-plain-sqs)[ Packagist](https://packagist.org/packages/friendsofcat/laravel-plain-sqs)[ Docs](https://github.com/dusterio/laravel-plain-sqs)[ RSS](/packages/friendsofcat-laravel-plain-sqs/feed)WikiDiscussions master Synced 1mo ago

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

Plain Sqs
=========

[](#plain-sqs)

[![Build Status](https://camo.githubusercontent.com/65a9e08b2b910bbb7ba79fc023258f5be2eb91930d5a8dbaa53be9e68ae8c04c/68747470733a2f2f7472617669732d63692e6f72672f647573746572696f2f6c61726176656c2d706c61696e2d7371732e737667)](https://travis-ci.org/dusterio/laravel-plain-sqs)[![Code Climate](https://camo.githubusercontent.com/a3f804cb82aacc4937847781b94f6c39546d117754433c33d8bbd0b1c3796eda/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f647573746572696f2f6c696e6b2d707265766965772f6261646765732f6770612e737667)](https://codeclimate.com/github/dusterio/link-preview/badges)[![Total Downloads](https://camo.githubusercontent.com/b3f9ceeb297428695bb15e2db62c04ad8f3449f47365e00006829f4e0c6983d7/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d706c61696e2d7371732f642f746f74616c2e737667)](https://packagist.org/packages/dusterio/laravel-plain-sqs)[![Latest Stable Version](https://camo.githubusercontent.com/8985b8b9ca53d7c2b3907e9b11fd7f803a6b200342847de11c2a97dc544136d8/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d706c61696e2d7371732f762f737461626c652e737667)](https://packagist.org/packages/dusterio/laravel-plain-sqs)[![Latest Unstable Version](https://camo.githubusercontent.com/9aafdc6c0fbbc152ab169f222dbfb1ff2fc52aa1d8ffa7bbcd04f080423fcb9c/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d706c61696e2d7371732f762f756e737461626c652e737667)](https://packagist.org/packages/dusterio/laravel-plain-sqs)[![License](https://camo.githubusercontent.com/2d4cebc720a0fcfcfdca16c13d99c3e035d2903f94b59514dc83bc948c682db1/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d706c61696e2d7371732f6c6963656e73652e737667)](https://packagist.org/packages/dusterio/laravel-plain-sqs)

A custom SQS connector for Laravel (or Lumen) that supports custom format JSON payloads. Out of the box, Laravel expects SQS messages to be generated in specific format - format that includes job handler class and a serialized job.

But in certain cases you may want to parse messages from third party applications, custom JSON messages and so on.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 5.5
- Laravel (or Lumen) &gt;= 5.2

Installation via Composer
-------------------------

[](#installation-via-composer)

To install simply run:

```
composer require dusterio/laravel-plain-sqs

```

Or add it to `composer.json` manually:

```
{
    "require": {
        "dusterio/laravel-plain-sqs": "~0.1"
    }
}
```

### Usage in Laravel 5

[](#usage-in-laravel-5)

```
// Add in your config/app.php

'providers' => [
    '...',
    'Dusterio\PlainSqs\Integrations\LaravelServiceProvider',
];
```

### Usage in Lumen 5

[](#usage-in-lumen-5)

```
// Add in your bootstrap/app.php
$app->loadComponent('queue', 'Dusterio\PlainSqs\Integrations\LumenServiceProvider');
```

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

[](#configuration)

```
// Generate standard config file (Laravel only)
php artisan vendor:publish

// In Lumen, create it manually (see example below) and load it in bootstrap/app.php
$app->configure('sqs-plain');
```

Edit config/sqs-plain.php to suit your needs. This config matches SQS queues with handler classes.

```
return [
    'handlers' => [
        'base-integrations-updates' => App\Jobs\HandlerJob::class,
    ],

    'default-handler' => App\Jobs\HandlerJob::class
];
```

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

Add sqs-plain connection to your config/queue.php, eg:

```
        ...
        'sqs-plain' => [
            'driver' => 'sqs-plain',
            'key'    => env('AWS_KEY', ''),
            'secret' => env('AWS_SECRET', ''),
            'prefix' => 'https://sqs.ap-southeast-2.amazonaws.com/123123/',
            'queue'  => 'important-music-updates',
            'region' => 'ap-southeast-2',
        ],
        ...
```

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

```
QUEUE_DRIVER=sqs-plain

```

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

[](#dispatching-to-sqs)

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

```
use Dusterio\PlainSqs\Jobs\DispatcherJob;

class ExampleController extends Controller
{
    public function index()
    {
        // Create a PHP object
        $object = [
            'music' => 'M.I.A. - Bad girls',
            'time' => time()
        ];

        // Pass it to dispatcher job
        $job = new DispatcherJob($object);

        // 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());
    }
}
```

This will push the following JSON object to SQS:

```
{"job":"App\\Jobs\\HandlerJob@handle","data":{"music":"M.I.A. - Bad girls","time":1462511642}}

```

'job' field is not used, actually. It's just kept for compatibility sake.

### Receiving from SQS

[](#receiving-from-sqs)

If a third-party application 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 HandlerJob extends Job
{
    protected $data;

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

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

Todo
----

[](#todo)

1. Add more unit and integration tests

Video tutorials
---------------

[](#video-tutorials)

I've just started a educational YouTube channel that will cover top IT trends in software development and DevOps: [config.sys](https://www.youtube.com/channel/UCIvUJ1iVRjJP_xL0CD7cMpg)

License
-------

[](#license)

The MIT License (MIT) Copyright (c) 2016 Denis Mysenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.1% 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

1159d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/deaa94d07a8cca75da55dcce1ed56e59d90dae65f06d2f74403a76394e24952f?d=identicon)[therobfonz](/maintainers/therobfonz)

---

Top Contributors

[![dusterio](https://avatars.githubusercontent.com/u/11039918?v=4)](https://github.com/dusterio "dusterio (27 commits)")[![therobfonz](https://avatars.githubusercontent.com/u/35386780?v=4)](https://github.com/therobfonz "therobfonz (5 commits)")[![jason-klein](https://avatars.githubusercontent.com/u/5200725?v=4)](https://github.com/jason-klein "jason-klein (5 commits)")[![fh-jashmore](https://avatars.githubusercontent.com/u/26600475?v=4)](https://github.com/fh-jashmore "fh-jashmore (3 commits)")[![sebastianvilla](https://avatars.githubusercontent.com/u/771527?v=4)](https://github.com/sebastianvilla "sebastianvilla (2 commits)")[![zandzpider](https://avatars.githubusercontent.com/u/321691?v=4)](https://github.com/zandzpider "zandzpider (1 commits)")[![4l3j4ndr0](https://avatars.githubusercontent.com/u/18580284?v=4)](https://github.com/4l3j4ndr0 "4l3j4ndr0 (1 commits)")[![ZekLouis](https://avatars.githubusercontent.com/u/18212301?v=4)](https://github.com/ZekLouis "ZekLouis (1 commits)")[![acavanagh](https://avatars.githubusercontent.com/u/1994544?v=4)](https://github.com/acavanagh "acavanagh (1 commits)")[![gitetsu](https://avatars.githubusercontent.com/u/44036?v=4)](https://github.com/gitetsu "gitetsu (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![matiaslauriti](https://avatars.githubusercontent.com/u/1213303?v=4)](https://github.com/matiaslauriti "matiaslauriti (1 commits)")

---

Tags

phplaravelawslumensqs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/friendsofcat-laravel-plain-sqs/health.svg)

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

###  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)[dusterio/laravel-plain-sqs

Custom SQS connector for Laravel that supports custom format JSON

1352.7M1](/packages/dusterio-laravel-plain-sqs)[shiftonelabs/laravel-sqs-fifo-queue

Adds a Laravel queue driver for Amazon SQS FIFO queues.

1556.0M3](/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.

48416.3k](/packages/joblocal-laravel-sqs-sns-subscription-queue)[joggapp/laravel-aws-sns

Laravel package for the SNS events by AWS

3171.8k](/packages/joggapp-laravel-aws-sns)

PHPackages © 2026

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