PHPackages                             chrisguitarguy/tactician-symfony-events - 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. chrisguitarguy/tactician-symfony-events

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

chrisguitarguy/tactician-symfony-events
=======================================

Tactician middleware for the Symfony event dispatcher.

1.0.0(10y ago)334.5k11MITPHPPHP ~5.6|~7.0CI failing

Since Feb 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chrisguitarguy/tactician-symfony-events)[ Packagist](https://packagist.org/packages/chrisguitarguy/tactician-symfony-events)[ RSS](/packages/chrisguitarguy-tactician-symfony-events/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (3)Used By (1)

Tactician Symfony Event Middleware
==================================

[](#tactician-symfony-event-middleware)

Use the [Symfony event dispatcher](http://symfony.com/doc/current/components/event_dispatcher/introduction.html)to get notifications when a command is received, handled, and/or errors in [Tactician](http://tactician.thephpleague.com/).

Usage
-----

[](#usage)

Add the middleware anywhere anywhere before the command handler middleware.

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use League\Tactician\CommandBus;
use Chrisguitarguy\Tactician\SymfonyEvents\EventMiddleware;
use Chrisguitarguy\Tactician\SymfonyEvents\CommandRecieved;
use Chrisguitarguy\Tactician\SymfonyEvents\CommandHandled;
use Chrisguitarguy\Tactician\SymfonyEvents\CommandFailed;

$eventMiddleware = new EventMiddlware($dispatcher = new EventDispatcher());

$commandBus = new CommandBus([
  // ...
  $eventMiddleware,
  $commandHandlerMiddleware,
  // ...
]);
```

You can listen for events specific to a single command.

```
use Acme\Example\SomeCommand;

$dispatcher->addListener('command.receieved.'.MyCommand::class, function (CommandReceived $event) {
    // called before the handler runs on SomeCommand
});

$dispatcher->addListener('command.handled.'.MyCommand::class, function (CommandHandled $event) {
    // called after the handler runs on SomeCommand
});

$dispatcher->addListener('command.failed.'.MyCommand::class, function (CommandFailed $event) {
    // called if one the handler or one of the `received` or `handled`
    // events throws an exeception from handling SomeCommand
});

$commandBus->execute(new SomeCommand());
```

Or listen to more generic events that fire on all commands.

```
use Acme\Example\SomeCommand;

$dispatcher->addListener('command.receieved', function (CommandReceived $event) {
    // called before the handler runs on all commands
});

$dispatcher->addListener('command.handled', function (CommandHandled $event) {
    // called after the handler runs on all commands
});

$dispatcher->addListener('command.failed', function (CommandFailed $event) {
    // called if one the handler or one of the `received` or `handled`
    // events throws an exception from handling any command
});

$commandBus->execute(new SomeCommand());
```

There's also a `CommandEvents` class that provides some constants and helpers for event names.

```
use Chrisguitarguy\Tactician\SymfonyEvents\CommandEvents;
use Acme\Example\SomeCommand;

// generic events are in constants.
$dispatcher->addListener(CommandEvents::RECEIVED, /*...*/);

// specific have helpers that take an object or class name
$dispatcher->addListener(CommandEvents::received(SomeCommand::class), /*...*/);

$command = new SomeCommand();
$dispatcher->addListener(CommandEvents::received($command), /*...*/);

$dispatcher->addListener(CommandEvents::HANDLED, /*...*/);
$dispatcher->addListener(CommandEvents::handled(SomeCommand::class), /*...*/);

$dispatcher->addListener(CommandEvents::FAILED, /*...*/);
$dispatcher->addListener(CommandEvents::failed(SomeCommand::class), /*...*/);

```

License
-------

[](#license)

MIT. See the `LICENSE` file.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~1621 days

Total

2

Last Release

2175d ago

Major Versions

1.0.0 → v2.0.0-RC12020-07-20

PHP version history (2 changes)1.0.0PHP ~5.6|~7.0

v2.0.0-RC1PHP ^7.2

### Community

Maintainers

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

---

Top Contributors

[![chrisguitarguy](https://avatars.githubusercontent.com/u/1010392?v=4)](https://github.com/chrisguitarguy "chrisguitarguy (5 commits)")[![digibeuk](https://avatars.githubusercontent.com/u/5148394?v=4)](https://github.com/digibeuk "digibeuk (1 commits)")[![frankverhoeven](https://avatars.githubusercontent.com/u/2358864?v=4)](https://github.com/frankverhoeven "frankverhoeven (1 commits)")

---

Tags

symfonyeventstactician

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chrisguitarguy-tactician-symfony-events/health.svg)

```
[![Health](https://phpackages.com/badges/chrisguitarguy-tactician-symfony-events/health.svg)](https://phpackages.com/packages/chrisguitarguy-tactician-symfony-events)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[pugx/autocompleter-bundle

Add an autocomplete type to forms

97870.3k3](/packages/pugx-autocompleter-bundle)[bornfreee/tactician-domain-events-bundle

Bundle to integrate Tactician Domain Events library with Symfony project

10139.1k](/packages/bornfreee-tactician-domain-events-bundle)[concrete5/core

Concrete core subtree split

20166.1k52](/packages/concrete5-core)

PHPackages © 2026

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