PHPackages                             snapsuzun/yii2-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. [Queues &amp; Workers](/categories/queues)
4. /
5. snapsuzun/yii2-sqs

ActiveYii2-extension[Queues &amp; Workers](/categories/queues)

snapsuzun/yii2-sqs
==================

Yii2 Amazon SQS watcher extension for handle messages from SQS queues

22345PHP

Since Feb 21Pushed 7y ago2 watchersCompare

[ Source](https://github.com/SnapSuzun/yii2-sqs)[ Packagist](https://packagist.org/packages/snapsuzun/yii2-sqs)[ RSS](/packages/snapsuzun-yii2-sqs/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Amazon SQS Watcher for Yii2
===========================

[](#amazon-sqs-watcher-for-yii2)

An extension for receiving and handling messages from Amazon SQS.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist snapsuzun/yii2-sqs

```

or add

```
"snapsuzun/yii2-sqs": "dev-master"

```

to the require section of your `composer.json` file.

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

[](#configuration)

To use this extension, simply add the following code in your application configuration:

```
return [
    'bootstrap' => ['sqsWatcher']
    //....
    'components' => [
        'sqsClient' => function () {
            return new \snapsuzun\sqs\SqsClient([
                'cridentials => [
                    'key' => 'Api key of Amazon AWS',
                    'secret' => 'Secret key of Amazon AWS'
                ],
                'region' => 'Region of Amazon SQS',
                'version' => 'latest',
                'accountId' => 'ID of account in Amazon AWS',
                'queueNameAliases' => [
                    'aliasForQueue' => 'Real name of queue in Amazon SQS',
                    'test_queue' => 'TestQueue.fifo'
                ]
            ]);
        },
        'sqsWatcher' => [
            'class' => '\snapsuzun\sqs\watcher\Watcher',
            'queueName' => 'queue',
            'handler' => function (array $messages, array &$receiptHandlers, \snapsuzun\sqs\SqsClient $client) {
                // handle messages
            }
        ],
    ],
];
```

Message Handler
---------------

[](#message-handler)

Handling messages from SQS queue may be by callback function or object which implements `\snapsuzun\sqs\watcher\HandlerInterface`.

Example of object what implements `\snapsuzun\sqs\watcher\HandlerInterface`:

```
class ExampleHandler implements \snapsuzun\sqs\watcher\HandlerInterface
{
        public $db = 'db';

        /**
         * @param array $messages
         * @param array $receiptHandlers
         * @param \snapsuzun\sqs\SqsClient $client
         */
        public function handleMessages(array $messages, array &$receiptHandlers, \snapsuzun\sqs\SqsClient $client)
        {
            // handle messages
        }
}
```

Usage `ExampleHandler`:

```
return [
    //.......
    'components' => [
        'sqsWatcher' => [
            //.....
            'handler' => ExampleHandler::class
        ]
    ]
];
```

Or:

```
return [
    //.......
    'components' => [
        'sqsWatcher' => [
            //.....
            'handler' => [
                'class' => ExampleHandler::class,
                'db' => 'db2'
            ]
        ]
    ]
];
```

When messages handling you can remove receipt handler from $receiptHandlers and message will not removed from SQS queue.

Console commands:
-----------------

[](#console-commands)

To listen queue you can use command:

```
./yii sqs-watcher/listen --isolate=1

```

If you want only handle messages in queue and not want to wait a new messages, you can use command:

```
./yii sqs-watcher/run --isolate=1

```

Option `isolate` enable creating a fork process for each batch of messages.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/60d1937e2d27cf2f157cf48ff57ad4ad08baeff18bbcd682f7f8732ef69df5c7?d=identicon)[SnapSuzun](/maintainers/SnapSuzun)

---

Top Contributors

[![SnapSuzun](https://avatars.githubusercontent.com/u/15728851?v=4)](https://github.com/SnapSuzun "SnapSuzun (3 commits)")

### Embed Badge

![Health badge](/badges/snapsuzun-yii2-sqs/health.svg)

```
[![Health](https://phpackages.com/badges/snapsuzun-yii2-sqs/health.svg)](https://phpackages.com/packages/snapsuzun-yii2-sqs)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.5M30](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6045.5M513](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[mayconbordin/l5-stomp-queue

Stomp Queue Driver for Laravel 5

121.1k](/packages/mayconbordin-l5-stomp-queue)

PHPackages © 2026

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