PHPackages                             trt/async-tasks-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. trt/async-tasks-bundle

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

trt/async-tasks-bundle
======================

This bundle allows to dispatch asynchronous events in symfony2. It uses RabbitMQ to send messages to the consumers..

7191PHP

Since Oct 15Pushed 11y agoCompare

[ Source](https://github.com/toretto460/async-task)[ Packagist](https://packagist.org/packages/trt/async-tasks-bundle)[ RSS](/packages/trt-async-tasks-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

AsyncTasksBundle
================

[](#asynctasksbundle)

About
-----

[](#about)

The AsyncTasksBundle allows to send asynchronous messages in your Symfony2 Application via [RabbitMq](http://www.rabbitmq.com/) (using the [php-amqplib](http://github.com/videlalvaro/php-amqplib) library).

PUBLISHING
----------

[](#publishing)

The message **publishing** is so easy.

- Create an async event `Trt\AsyncTasksBundle\Event\AsyncEvent`
- Dispatch it!
- Done

```
    $event = new AsyncEvent(
        'async_event_name',
        array('date'=> (new \DateTime())->format('d-m-Y H:s')
        )
    );
    $this->get('event_dispatcher')->dispatch($event->getName(), $event);
```

CONSUMING
---------

[](#consuming)

Now if you want **consume** the messages

- Write your domain specific service implementing the `Trt\AsyncTasksBundle\Listener\ListenerInterface` interface.
- Tag the service with `{name: trt_async.listener.listen, event: async_event_name} `, the *event* key is the event name.
- Run

```
$ app/console trt:async:run async_event_name
```

All the examples expect a running RabbitMQ server.

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

[](#installation)

This instructions have been tested on a project created with the [Symfony2 Standard 2.3.4](http://symfony.com/download)

Add the AsyncTasksBundle to your composer.json and type composer install.

```
    "require": {
        "php": ">=5.3.3",
        ....
        "trt/async-tasks-bundle": "dev-master",
        ...
    },
```

Add the AsyncTasksBundle to your application's kernel:

```
public function registerBundles()
{
    $bundles = array(
        ...
        new Trt\AsyncTasksBundle\TrtAsyncTasksBundle(),
        ...
    );
    ...
}
```

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

[](#configuration)

```
trt_async_tasks:
    # This prefix allows the dispatcher to detect async event,
    # if you want use another prefix put here
    event:
        prefix: async_
    mq:
        # The rabbitMq host / port
        connection_params:
            host: %mq_host%
            port: %mq_port%
        # Define the exchange name for rabbitmq
        exchange:
            exchange: 'exchange_symfony_events'
```

Naming Conventions
------------------

[](#naming-conventions)

AsyncTasksBundle's event detection mechanism is based on naming convention, the event name will be the same of queue name. every event with name containing the `async` string will be detected as AysncEvent.

The name prefix cold be overridden via config

```
trt_async_tasks:
    event:
        prefix: acme_async
```

This bundle will be shown at SymfonyDayIt 2013 (Rome)
-----------------------------------------------------

[](#this-bundle-will-be-shown-at-symfonydayit--2013-rome)

Fork it and contribute to solve the issues :-)

License
-------

[](#license)

See: resources/meta/LICENSE.md

Credits
-------

[](#credits)

The bundle structure and the documentation is partially based on the [SonataNotificationBundle](https://github.com/sonata-project/SonataNotificationBundle)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.2% 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/97e5b23c6d1b7bd92d3ab1b3219515ab17cb504562b76e8694be6238470b87c1?d=identicon)[toretto460](/maintainers/toretto460)

---

Top Contributors

[![simodima](https://avatars.githubusercontent.com/u/1193857?v=4)](https://github.com/simodima "simodima (9 commits)")[![danielsan80](https://avatars.githubusercontent.com/u/452881?v=4)](https://github.com/danielsan80 "danielsan80 (4 commits)")

### Embed Badge

![Health badge](/badges/trt-async-tasks-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/trt-async-tasks-bundle/health.svg)](https://phpackages.com/packages/trt-async-tasks-bundle)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2238.8M171](/packages/react-async)

PHPackages © 2026

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