PHPackages                             tjovaisas/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. [Database &amp; ORM](/categories/database)
4. /
5. tjovaisas/delayed-event-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

tjovaisas/delayed-event-bundle
==============================

Bundle to handle post flush doctrine event in an usual event manner

0.4.0(4y ago)13.0kMITPHPPHP ^8.0

Since May 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tomas7777/lib-delayed-event-bundle)[ Packagist](https://packagist.org/packages/tjovaisas/delayed-event-bundle)[ RSS](/packages/tjovaisas-delayed-event-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (0)

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

[](#delayed-event-bundle)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9f6e10c19239c6e20f43c6a917a5377e33c31a91183ea33ff55ec6bbe757b38e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746a6f7661697361732f64656c617965642d6576656e742d62756e646c653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tjovaisas/delayed-event-bundle)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHPUnit](https://github.com/tomas7777/lib-delayed-event-bundle/actions/workflows/phpunit.yml/badge.svg)](https://github.com/tomas7777/lib-delayed-event-bundle/actions/workflows/phpunit.yml/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/b54bc50017589bd77b7a67ba0153cddb9e6d06d812e2d9d83c55a3f1e1fe5800/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746a6f7661697361732f64656c617965642d6576656e742d62756e646c653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tjovaisas/delayed-event-bundle)

Symfony bundle to handle post flush doctrine event in an usual event manner

Why ?
-----

[](#why-)

Symfony already offers great way to dispatch events to predefined subscribers. This bundle extends that functionality to let listeners receive a dispatched event only after flush has been called. There are a few reasons for that:

- application needs to make external calls only after data been written to the database;
- application needs to publish data to queue only after data been written to the database;
- applications logic requires flushing only in the upper level (e.g. controller or command) while most of the logic lies deep into the services. This helps to avoid having multiple events dispatched from the controllers or commands;
- application needs to make other extra steps only after data been written to the database;

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

[](#installation)

```
composer require tjovaisas/delayed-event-bundle

```

### Register the bundle:

[](#register-the-bundle)

Register bundle into `config/bundles.php`:

```
return [
    //...
    \Tjovaisas\Bundle\DelayedEventBundle\TjovaisasDelayedEventBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

Bundle can be configured either using service's configuration's definition or by using attributes:

- Default `kernel.event_listener` tag can be changed to `tjovaisas.event_listener.post_flush` to dispatch message to the given listener after flush occured:

```

```

- Using attributes. Attribute can be defined either on the whole class

```
#[AsDelayedEventListener(event: 'some_event', method: 'onEvent', priority: 1)]
class SomeListener
{
    //...
}
```

or on classes method (only for Symfony ^6.0):

```
#[AsDelayedEventListener(event: 'some_event')]
public function onEvent(): void
{
    //...
}
```

Caviats
-------

[](#caviats)

There is no easy way to know if an entity already appears in the database after the changes if transaction is being used.

Due to doctrine's default behavior using transactions, first action being used is `flush` and later on `commit`. That means that listener may get event with data that already has database generated fields (e.g. `id`), but still may not be 100% in the database. Transactions are being sealed only after `commit` has been called and if this action fails, changes will not appear in the database and listener wouldn't know that.

Semantic versioning
-------------------

[](#semantic-versioning)

This bundle follows [semantic versioning](http://semver.org/spec/v2.0.0.html).

Public API of this bundle (in other words, you should only use these features if you want to easily update to new versions):

- only services that are not marked as `public="false"`;
- only classes, interfaces and class methods that are marked with `@api`;
- console commands;
- supported DIC tags.

For example, if only class method is marked with `@api`, you should not extend that class, as constructor could change in any release.

See [Symfony BC rules](https://symfony.com/doc/current/contributing/code/bc.html) for basic information about what can be changed and what not in the API. Keep in mind, that in this bundle everything is `@internal` by default.

Running tests
-------------

[](#running-tests)

```
composer update
composer test

```

Contributing
------------

[](#contributing)

Feel free to create issues and give pull requests.

You can check code style issues using this command:

```
composer analyze

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~91 days

Total

4

Last Release

1554d ago

PHP version history (3 changes)0.1.0PHP ^7.3 || ^8.0

0.2.0PHP ^7.4 || ^8.0

0.3.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9091359?v=4)[Tomas Jovaišas](/maintainers/tomas7777)[@tomas7777](https://github.com/tomas7777)

---

Top Contributors

[![tomas7777](https://avatars.githubusercontent.com/u/9091359?v=4)](https://github.com/tomas7777 "tomas7777 (17 commits)")

---

Tags

doctrineeventflusheventsymfonydoctrineflush

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

813.1k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

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