PHPackages                             fervo/deferred-event-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. fervo/deferred-event-bundle

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

fervo/deferred-event-bundle
===========================

Defer your events to another process (via FastCGI)

0.3.1(7y ago)4393.5k10[2 issues](https://github.com/fervo/FervoDeferredEventBundle/issues)[2 PRs](https://github.com/fervo/FervoDeferredEventBundle/pulls)MITPHPPHP &gt;=5.4

Since Nov 24Pushed 7y ago9 watchersCompare

[ Source](https://github.com/fervo/FervoDeferredEventBundle)[ Packagist](https://packagist.org/packages/fervo/deferred-event-bundle)[ RSS](/packages/fervo-deferred-event-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (12)Used By (0)

FervoDeferredEventBundle
========================

[](#fervodeferredeventbundle)

This bundle allows you to run asynchronous background processes in PHP. You don't need a PHP-daemon nor do you have to create a new php process for each job (which is expensive). We use PHP-FPM because it solves the performance and stability issues for us.

I wrote [a blog entry](http://joiedetech.se/2013-11-25-improving-symfony-workers) with the reasoning behind this bundle, which you may want to read.

Caveat
------

[](#caveat)

*This project is no longer actively developed by Fervo. We're still willing to merge PRs, but we're moving away from this internally. If you have a vested interest in this project and want to adopt it, contact us at .*

Usage
-----

[](#usage)

You can defer events in two ways. You can decide when you dispatch an event that it should be deferred or you could let some listeners to decide if they should be deferred or not. In both cases we dispatch the event and put the job on a message queue.

As if by magic, at some later time, a worker will dispatch your event to your listeners. Pretty much the only caveats you'll need to keep in mind is that it is in another process, and that the code isn't executing in the request scope anymore.

### Let the listeners decide

[](#let-the-listeners-decide)

Just tag your listener with `fervo_deferred_event.listener` instead of `kernel.event_listener`, and the bundle will do the rest. Simple as pie.

### Let the publisher decide

[](#let-the-publisher-decide)

If you want all listeners to a event to be executed in a different thread you must wrap your Event in a DeferEvent. Then use the event dispatcher and dispatch 'fervo.defer'.

```
$event = new DeferEvent('foo.action', new MyEvent());
$this->get('event_dispatcher')->dispatch('fervo.defer', $event);
```

Setup
-----

[](#setup)

### Server software

[](#server-software)

You need to install a message queue and a worker. The worker will pull jobs from the message queue and initiate the execution.

Currently we do support all message queues that support [AMQP](http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol)and Sidekiq.

Here is a list of workers:

- [fervo/deferred-event-worker](https://github.com/fervo/deferred-event-worker) written in Ruby.
- [HappyR/DeferredEventJavaWorker](https://github.com/HappyR/DeferredEventJavaWorker) written in Java.

### Symfony setup

[](#symfony-setup)

Add the bundle to your composer file, as well as well as your AppKernel. Configure the bundle as follows:

```
# Sidekiq example
fervo_deferred_event:
    backend:
        type: sidekiq
        sidekiq_client_service: sidekiq_client

# Java/AMQP example:
fervo_deferred_event:
    backend:
        type: amqp
        amqp_config:
            host: "localhost"             #default
            port: 5672                    #default
            batch_publishing: false       #can only be true if you are using videlalvaro/php-amqplib v.2.2.0 or above
        message_headers:
            fastcgi_host: "localhost"     #default
            fastcgi_port: 9000            #default

```

You do also need to setup one of the following (depending on you backend type):

- [musicglue/sidekiq-job-pusher](https://github.com/musicglue/sidekiq-job-pusher/). Set up a client service, and pass it into the configuration.
- [videlalvaro/php-amqplib](https://github.com/videlalvaro/php-amqplib/). Just add it to your composer.json.

Error handling
--------------

[](#error-handling)

The Java worker we take care of errors. When a worker unexpectedly terminates we will save the message and the error message on a separate queue. You may subscribe to that queue to log the error and to retry executing the job.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~198 days

Recently: every ~77 days

Total

6

Last Release

2838d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.3

0.2.0PHP &gt;=5.4

### Community

Maintainers

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

---

Top Contributors

[![magnusnordlander](https://avatars.githubusercontent.com/u/165002?v=4)](https://github.com/magnusnordlander "magnusnordlander (25 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (12 commits)")[![morticue](https://avatars.githubusercontent.com/u/165028?v=4)](https://github.com/morticue "morticue (10 commits)")[![nicholasruunu](https://avatars.githubusercontent.com/u/483658?v=4)](https://github.com/nicholasruunu "nicholasruunu (5 commits)")[![bit0rez](https://avatars.githubusercontent.com/u/1796284?v=4)](https://github.com/bit0rez "bit0rez (2 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (1 commits)")[![smurfy](https://avatars.githubusercontent.com/u/805790?v=4)](https://github.com/smurfy "smurfy (1 commits)")

### Embed Badge

![Health badge](/badges/fervo-deferred-event-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/fervo-deferred-event-bundle/health.svg)](https://phpackages.com/packages/fervo-deferred-event-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[php-amqplib/rabbitmq-bundle

Integrates php-amqplib with Symfony &amp; RabbitMq. Formerly emag-tech-labs/rabbitmq-bundle, oldsound/rabbitmq-bundle.

1.3k20.1M64](/packages/php-amqplib-rabbitmq-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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