PHPackages                             tritran/sqs-queue-bundle - 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. tritran/sqs-queue-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

tritran/sqs-queue-bundle
========================

Simple SQS Queue for Symfony

2.1.4(6y ago)27239.9k—7%19[2 issues](https://github.com/trandangtri/sqs-queue-bundle/issues)[2 PRs](https://github.com/trandangtri/sqs-queue-bundle/pulls)MITPHPPHP &gt;=7.0.0CI failing

Since Jul 5Pushed 3y ago5 watchersCompare

[ Source](https://github.com/trandangtri/sqs-queue-bundle)[ Packagist](https://packagist.org/packages/tritran/sqs-queue-bundle)[ Docs](http://www.ideason.vn)[ RSS](/packages/tritran-sqs-queue-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (19)Used By (0)

Simple AWS SQS Queue for Symfony
================================

[](#simple-aws-sqs-queue-for-symfony)

This bundle provides an easy way to work with AWS SQS

[![SensioLabsInsight](https://camo.githubusercontent.com/26dc9c5e0d9ae4c1046d41c7206cb3bfc06e5fbbededefac839c6b5ebfe63a19/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39363665323531352d303137372d346238302d386566302d6366633962643830306138312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/966e2515-0177-4b80-8ef0-cfc9bd800a81)[![Latest Stable Version](https://camo.githubusercontent.com/7b416695383ffdb931c2abc08c71cd291b853fc98b39526d06bc5c2ebf793f68/68747470733a2f2f706f7365722e707567782e6f72672f7472697472616e2f7371732d71756575652d62756e646c652f762f737461626c65)](https://packagist.org/packages/tritran/sqs-queue-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/6a125ae89424a7f601773934da4cc3b97d47f647c9833bcefbcb76e212a98e25/68747470733a2f2f706f7365722e707567782e6f72672f7472697472616e2f7371732d71756575652d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/tritran/sqs-queue-bundle)[![Build Status](https://camo.githubusercontent.com/133a0f9fb944edbda064fd997191f9efe51173b9c0d46532c7cc265c0228ea7b/68747470733a2f2f6170692e7472617669732d63692e6f72672f7472616e64616e677472692f7371732d71756575652d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/trandangtri/sqs-queue-bundle)[![codecov](https://camo.githubusercontent.com/bd003dca06dc9bffb7140e3c201340e1c9673b41faf2c31dda921dd72237279c/68747470733a2f2f636f6465636f762e696f2f67682f7472616e64616e677472692f7371732d71756575652d62756e646c652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/trandangtri/sqs-queue-bundle)

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

[](#installation)

Follow 5 quick steps to setup this bundle.

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require tritran/sqs-queue-bundle
```

> This command requires you to have Composer installed globally

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Register bundles in `app/AppKernel.php`:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return [
            // ...
            new \Aws\Symfony\AwsBundle(),
            new \TriTran\SqsQueueBundle\TriTranSqsQueueBundle(),
        ];
    }

    // ...
}
```

> In a default Symfony application that uses [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), bundles are enabled/disabled automatically for you when installing/removing them, so you could ignore this step.

### Step 3: Update AWS SQS Credential

[](#step-3-update-aws-sqs-credential)

This bundle is using [AWS SDK for PHP](https://github.com/aws/aws-sdk-php-symfony). Full documentation of the configuration options available can be read in the [SDK Guide](http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html).

Below are sample configuration for AWS Credential in YAML format

```
# app/config/config.yml

aws:
    version: latest
    region: us-central-1
    credentials:
        key: not-a-real-key
        secret: "@not-a-real-secret"
```

### Step 4: Configure the Queues

[](#step-4-configure-the-queues)

Below are sample configuration for some queues in YAML format

```
# app/config/config.yml

tritran_sqs_queue:
    sqs_queue:
        queues:
            emailpool:
                queue_url: 'https://sqs.eu-central-1.amazonaws.com/49504XX59872/emailpool'
                worker: "@acl.service.emailpool"
                attributes:
                    receive_message_wait_time_seconds: 20
                    visibility_timeout: 30
            reminder:
                queue_url: 'https://sqs.eu-central-1.amazonaws.com/49504XX59872/reminder'
                worker: 'AclBundle\Service\Worker\ReminderWorker'
```

Full documentation of the queue options available can be read in the [Queue Attributes](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html).

> Now, you could access to queue `emailpool` or `reminder` service via `tritran.sqs_queue.emailpool` or `tritran.sqs_queue.reminder`, it's an interface of [BaseQueue](https://github.com/trandangtri/sqs-queue-bundle/blob/master/Service/BaseQueue.php)

Below are a sample implementation of sending a message to a specified queue

```
namespace AclBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use TriTran\SqsQueueBundle\Service\Message;

/**
 * Class DefaultController
 *
 * @package AclBundle\Controller
 */
class DefaultController extends Controller
{
    public function indexAction()
    {
        // ...

        $data = [
            'from' => 'sender@domain.com',
            'to' => 'receiver@domain.com',
            'subject' => 'Greeting Message',
            'body' => 'Congratulation! You have just received a message which was sent from AWS SQS Queue'
        ];
        $this->get('tritran.sqs_queue.emailpool')
            ->sendMessage((new Message())->setBody(serialize($data)));

        // ...
    }
}
```

> For a FIFO queue, you must associate a non-empty `MessageGroupId` with a message. Otherwise, the action fails.
> You may provide a `MessageDeduplicationId` explicitly. If you aren't able to provide a `MessageDeduplicationId` and you enable `ContentBasedDeduplication` for your queue, Amazon SQS uses a SHA-256 hash to generate the `MessageDeduplicationId` using the body of the message (but not the attributes of the message).
> For more information about FIFO queue, please take a look at [Amazon SQS FIFO (First-In-First-Out) Queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html)

#### Queue Behaviours

[](#queue-behaviours)

BehaviourArgumentsDescriptionsendMessage`Message` $message
`int` $delay = 0Delivers a message to the specified queue.receiveMessage`int` $limit = 1Retrieves one or more messages (up to 10), from the specified queue. Using the WaitTimeSeconds parameter enables long-poll support. For more information, see [Amazon SQS Long Polling](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html) in the Amazon SQS Developer Guide.deleteMessage`string` $receiptHandleDeletes the specified message from the specified queue. You specify the message by using the *message's receipt handle* and not the *MessageId* you receive when you send the message. Even if the message is locked by another reader due to the visibility timeout setting, it is still deleted from the queue. If you leave a message in the queue for longer than the queue's configured retention period, Amazon SQS automatically deletes the message.purgeDeletes the messages in a queue specified by the QueueURL parameter. **Note**: you can't retrieve a message deleted from a queue.#### Queue Manager Behaviours

[](#queue-manager-behaviours)

> You could access [QueueManager](https://github.com/trandangtri/sqs-queue-bundle/blob/master/Service/QueueManager.php) via service `tritran.sqs_queue.queue_manager`

BehaviourArgumentsDescriptionlistQueue`string` $prefix = ''Returns a list of your queues. The maximum number of queues that can be returned is 1,000. If you specify a value for the optional *prefix* parameter, only queues with a name that begins with the specified value are returned.createQueue`string` $queueName
`array` $queueAttributeCreates a new standard or FIFO queue. You can pass one or more attributes in the request.deleteQueue`string` $queueUrlDeletes the queue specified by the **QueueUrl**, regardless of the queue's contents. If the specified queue doesn't exist, Amazon SQS returns a successful response.setQueueAttributes`string` $queueUrl
`array` $queueAttributeSets the value of one or more queue attributes. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS systemgetQueueAttributes`string` $queueUrlGets attributes for the specified queue.### Step 5: Setup a worker

[](#step-5-setup-a-worker)

Below are a sample implementation of a worker, which will listen to a queue to handle the messages inside.

```
namespace AclBundle\Service\Worker;

use TriTran\SqsQueueBundle\Service\Message;
use TriTran\SqsQueueBundle\Service\Worker\AbstractWorker;

class ReminderWorker extends AbstractWorker
{
    /**
     * @param Message $message
     *
     * @return boolean
     */
    protected function execute(Message $message)
    {
        echo 'The message is: ' . $message->getBody();

        return true;
    }
}
```

And then you could make it executed as daemon in console via:

```
bin/console tritran:sqs_queue:worker reminder
```

> Note: **reminder** is the name of queue which you configured in the config.yml in step 4.

### Appendix: Useful Console Commands

[](#appendix-useful-console-commands)

BehaviourDescriptiontritran:sqs\_queue:createCreates a new standard or FIFO queue. You can pass one or more attributes in the request.tritran:sqs\_queue:updateUpdate queue attribute based on its configuration which shown in config.ymltritran:sqs\_queue:deleteDelete a queue by url and all its messagestritran:sqs\_queue:attrRetrieve the attribute of a specified queuetritran:sqs\_queue:purgeDeletes the messages in a queue specified by the QueueURL parameter.tritran:sqs\_queue:workerStart a worker that will listen to a specified SQS queuetritran:sqs\_queue:pingSend a simply message to a queue, for DEBUG only> Note: Please using `-h` for more information for each command.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~64 days

Recently: every ~129 days

Total

16

Last Release

2280d ago

Major Versions

1.2.4 → 2.0.02018-02-07

PHP version history (2 changes)1.0PHP &gt;=5.5

2.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fc8091507047f6cabbf00ae801779841bb92b20e978ce6d7b1bd00154c8efe5?d=identicon)[moprit](/maintainers/moprit)

---

Top Contributors

[![trandangtri](https://avatars.githubusercontent.com/u/7868214?v=4)](https://github.com/trandangtri "trandangtri (80 commits)")[![petehouston](https://avatars.githubusercontent.com/u/9006720?v=4)](https://github.com/petehouston "petehouston (5 commits)")[![N-M](https://avatars.githubusercontent.com/u/781417?v=4)](https://github.com/N-M "N-M (4 commits)")[![wcomnisky](https://avatars.githubusercontent.com/u/133863?v=4)](https://github.com/wcomnisky "wcomnisky (1 commits)")

---

Tags

amazonaws-sqsmessage-queuephpqueue-workerssqs-queuesymfonysymfony-bundle

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tritran-sqs-queue-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tritran-sqs-queue-bundle/health.svg)](https://phpackages.com/packages/tritran-sqs-queue-bundle)
```

###  Alternatives

[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[mmoreram/gearman-bundle

Adds gearman support to your and Symfony4, Symfony5 project

237395.2k2](/packages/mmoreram-gearman-bundle)[webfactory/icu-translation-bundle

Enables ICU message formatting for translations in Symfony applications.

2761.8k](/packages/webfactory-icu-translation-bundle)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[ecotone/symfony-bundle

Extends Ecotone with Symfony integration

11229.0k1](/packages/ecotone-symfony-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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