Symfony Queue Bundle

Installs: 19 327

Dependents: 1

Suggesters: 0

Security: 0

Stars: 31

Watchers: 8

Forks: 1


v2.0.0 2017-10-18 00:18 UTC

This package is auto-updated.

Last update: 2024-06-05 18:05:34 UTC



Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version License


  • Require the bundle with composer:
composer require symfony-bundles/queue-bundle
  • Enable the bundle in the kernel:
public function registerBundles()
    $bundles = [
        // ...
        new SymfonyBundles\QueueBundle\SymfonyBundlesQueueBundle(),
        // ...
  • Configure the queue bundle in your config.yml.

Defaults configuration:

        alias: 'queue' # alias for service `sb_queue` (e.g. $this->get('queue'))
        class: 'SymfonyBundles\QueueBundle\Service\Queue'
        storage: 'redis' # storage key from `queue.storages` section
        queue_default_name: 'queue:default' # default name for queue
            class: 'SymfonyBundles\QueueBundle\Service\Storage\RedisStorage'
            client: 'sb_redis.client.default' # storage client service id

How to use

A simple example of the use of the queue:

$queue = $this->get('sb_queue'); // get the service
// or use: $this->get('queue'); the `queue` service use as alias,
// which setting in config.yml in parameter `sb_queue.service.alias`

// adding some data to queue
$queue->push('User "demo" registered');
$queue->push(new \stdClass);

// get count of items from queue
$queue->count(); // returns integer: 3
// now, we can get the data at any time in the queue order

// get data from queue
$queue->pop(); // returns string: User "demo" registered
$queue->count(); // returns integer: 2
$queue->pop(); // returns integer: 1234567890
$queue->count(); // returns integer: 1
$queue->pop(); // returns object: object(stdClass)
$queue->count(); // returns integer: 0

If you want to change the queue:

// adding data to queue `notifications`
$queue->push('You have a new message from Jessica');

// adding data to queue `settings`
$queue->push('User with ID 123 changed password');

// adding data to default queue
$queue->push('To be or not to be');