PHPackages                             atournayre/entities-events-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. atournayre/entities-events-bundle

AbandonedArchivedSymfony-bundle

atournayre/entities-events-bundle
=================================

This bundle provides a way to dispatch events when entities are created, updated or deleted using Doctrine ORM events and Symfony EventDispatcher.

010PHP

Since Nov 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/atournayre/entities-events-bundle)[ Packagist](https://packagist.org/packages/atournayre/entities-events-bundle)[ RSS](/packages/atournayre-entities-events-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Atournayre Entities Events Bundle
=================================

[](#atournayre-entities-events-bundle)

This bundle provides a way to dispatch events when entities are created, updated or deleted using Doctrine ORM events and Symfony EventDispatcher.

Requirements
------------

[](#requirements)

Symfony `^6 || ^7`

PHP `>=8.2`

Install
-------

[](#install)

Use [Composer](https://getcomposer.org) to install the package:

### Composer

[](#composer)

```
composer require atournayre/entities-events-bundle
```

### Register bundle

[](#register-bundle)

```
// config/bundles.php

return [
    // ...
    Atournayre\Bundle\EntitiesEventsBundle\AtournayreEntitiesEventsBundle::class => ['all' => true],
    // ...
]
```

### Install listeners

[](#install-listeners)

```
php bin/console atournayre:entities-events:generate-listeners
```

Usage example
-------------

[](#usage-example)

### Update your entity

[](#update-your-entity)

```
use Atournayre\Bundle\EntitiesEventsBundle\Collection\EventCollection;
use Atournayre\Bundle\EntitiesEventsBundle\Contracts\HasEventsInterface;

// Implements HasEventsInterface
class YourEntity implements HasEventsInterface
{
  // Use EventsTrait to implement HasEventsInterface
  use EventsTrait;

  public function __construct()
  {
    // Initialize the collection of events
    $this->eventCollection = new EventCollection();
  }

  public function doSomething(): void
  {
    // Do something here
    // Then dispatch an event
    $this->addEvent(new YourEvent($this));
  }
}
```

### Create an event

[](#create-an-event)

```
use Symfony\Contracts\EventDispatcher\Event;

class YourEvent extends Event
{
  public function __construct(
    public readonly YourEntity $entity
  ) {}
}
```

### Handle an event

[](#handle-an-event)

```
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
class YourEventListener
{
  public function __invoke(YourEvent $event): void
  {
    // Do something here
  }
}
```

That's all, the bundle will do the rest.

Contribute
----------

[](#contribute)

Contributions to the package are always welcome!

- Report any bugs or issues you find on the [issue tracker](https://github.com/atournayre/entities-events-bundle/issues).
- You can grab the source code at the package's [Git repository](https://github.com/atournayre/entities-events-bundle).

License
-------

[](#license)

All contents of this package are licensed under the [MIT license](LICENSE).

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.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/be702ea3d10de6d97d83c32866fc9cfe1830a055e7f8b685c8434ccad40416c1?d=identicon)[atournayre](/maintainers/atournayre)

---

Top Contributors

[![atournayre](https://avatars.githubusercontent.com/u/4262077?v=4)](https://github.com/atournayre "atournayre (20 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/atournayre-entities-events-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/atournayre-entities-events-bundle/health.svg)](https://phpackages.com/packages/atournayre-entities-events-bundle)
```

PHPackages © 2026

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