PHPackages                             vivait/delayed-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vivait/delayed-event-bundle

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

vivait/delayed-event-bundle
===========================

A bundle that delays events for a configurable time period (i.e. 24 hours)

2.2.0(3y ago)326.8k1MITPHPPHP ^7.4|^8.0CI failing

Since Sep 30Pushed 3y ago4 watchersCompare

[ Source](https://github.com/vivait/DelayedEventBundle)[ Packagist](https://packagist.org/packages/vivait/delayed-event-bundle)[ RSS](/packages/vivait-delayed-event-bundle/feed)WikiDiscussions 2.x Synced 2d ago

READMEChangelog (10)Dependencies (25)Versions (42)Used By (0)

Delayed Event Bundle
====================

[](#delayed-event-bundle)

Triggers a Symfony event an arbitrary period after the original event

Configure the service
=====================

[](#configure-the-service)

```
vivait_delayed_event:
    queue_transport: beanstalkd # default
```

Beanstalkd queue transport
--------------------------

[](#beanstalkd-queue-transport)

This relies on [pheanstalk](https://github.com/armetiz/LeezyPheanstalkBundle/blob/master/Resources/doc/1-installation.md)being installed and setup in your config. You can pass extra information to the beanstalk queue using the `configuration` parameter:

Be aware TTR is the time a process can run before it effectively retries, if it's too short there is a realistic possibility that a job will be processed twice.

```
vivait_delayed_event:
    queue_transport:
        name: beanstalkd
        configuration:
            tube: my_tube
            ttr: 60
```

Creating a delayed event
========================

[](#creating-a-delayed-event)

Instead of tagging the event with a kernel tag, tag the event with a `delayed_event` tag and provide a delay:

```
# app/config/services.yml
services:
    app.your_listener_name:
        class: AppBundle\EventListener\AcmeListener
        tags:
            - { name: delayed_event.event_listener, delay: '24 hours', event: app.my_event, method: onMyEvent }
```

By default, any integer will be treated as seconds. The bundle will use [PHP's textual datetime parsing](http://php.net/manual/en/function.strtotime.php)to parse a textual datetime string in to seconds like in the example above.

Transformers
============

[](#transformers)

If you're delaying an event, rather than store the exact state of an entity at the time of the event, you'll probably want to receive the latest version of the entity. The bundle allows the usage of transformers, which are ran before each property of an event is serialized. By default, the bundle has an entity transformer enabled, which will detect any entities in an event and store a reference to an entity. This means that when the entity is unserialized for the delayed event, a fresh entity is loaded from the database.

You can enable/disable transformers on a global level:

```
# app/config.yml
vivait_delayed_event:
    storage: delayed_event_cache
    transformers:
        doctrine: disabled
```

You can also enable/disable them when tagging an event listener:

```
# app/config/services.yml
services:
    app.your_listener_name:
        class: AppBundle\EventListener\AcmeListener
        tags:
            - {
                name: delayed_event.event_listener, delay: '24 hours', event: app.my_event, method: onMyEvent,
                transformers: [doctrine]
            }
```

*Note:* The `enabled` part is optional, and in the example above has been left out for brevity.

You can create custom transformers by implementing the `TransformerInterface` interface, like so:

```
class AcmeTransformer implements TransformerInterface
{
    /**
* @param ReflectionProperty $property
 * @return bool
*/public function supports(\ReflectionProperty $property) {
        $property->getValue();
        return is_object($data) && $this->doctrine->contains($data);
    }

    /**
* @param $data
 * @return array
*/public function serialize($data)
    {
        // Get the ID
        $id = $this->doctrine->getMetaData($data)->getIdentifierFieldNames();

        $class = get_class($data);

        /* @var UnitOfWork $uow */
        $uow = $this->doctrine->getUnitOfWork();
        $id = $uow->getDocumentIdentifier($data);

        return [
            $class,
            $id
        ];
    }

    /**
* @param $data
 * @return mixed
*/public function deserialize($data)
    {
        [$class, $id] = $data;
        return $this->doctrine->getRepository($class)->find($id);
    }
}
```

You must then tag the custom transformer:

```
# app/config/services.yml
services:
    app.your_transformer_name:
        class: AppBundle\EventTransformer\AcmeTransformer
        tags:
            - { name: your_transformer_name }
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 55.1% 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 ~74 days

Recently: every ~94 days

Total

39

Last Release

1100d ago

Major Versions

0.14.2 → 1.0.02022-05-16

0.x-dev → 1.x-dev2022-05-19

1.x-dev → 2.0.02022-06-18

PHP version history (5 changes)0.1.0PHP &gt;=5.4

0.8.0PHP ^7.1

0.10.0PHP ^7.2

0.13.0PHP ^7.2 | ^8.0

1.0.0PHP ^7.4|^8.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/69b7a2b44dd490af24dea8ebf3bade15057a27dafbfa31057742c548be5fa0f3?d=identicon)[LewisW](/maintainers/LewisW)

---

Top Contributors

[![LewisW](https://avatars.githubusercontent.com/u/17803?v=4)](https://github.com/LewisW "LewisW (76 commits)")[![kieljohn](https://avatars.githubusercontent.com/u/1641880?v=4)](https://github.com/kieljohn "kieljohn (41 commits)")[![kane-menicou](https://avatars.githubusercontent.com/u/21258569?v=4)](https://github.com/kane-menicou "kane-menicou (10 commits)")[![leightonthomas](https://avatars.githubusercontent.com/u/14091070?v=4)](https://github.com/leightonthomas "leightonthomas (4 commits)")[![Brunty](https://avatars.githubusercontent.com/u/1573273?v=4)](https://github.com/Brunty "Brunty (3 commits)")[![jamesyo](https://avatars.githubusercontent.com/u/13570063?v=4)](https://github.com/jamesyo "jamesyo (2 commits)")[![clophie](https://avatars.githubusercontent.com/u/11523339?v=4)](https://github.com/clophie "clophie (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vivait-delayed-event-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[open-dxp/opendxp

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

9421.6k61](/packages/open-dxp-opendxp)[sylius/sylius

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

8.5k5.9M737](/packages/sylius-sylius)[pimcore/pimcore

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

3.8k3.8M507](/packages/pimcore-pimcore)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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