PHPackages                             tomwright/eventing - 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. tomwright/eventing

ActiveLibrary

tomwright/eventing
==================

A simple event handler.

1.0.0(10y ago)0351PHP

Since Mar 23Pushed 10y ago1 watchersCompare

[ Source](https://github.com/TomWright/Eventing)[ Packagist](https://packagist.org/packages/tomwright/eventing)[ RSS](/packages/tomwright-eventing/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Eventing
========

[](#eventing)

[![Build Status](https://camo.githubusercontent.com/3cf24382d475e7256c60f87f72f7d65be865fe3bf7e646fd16338ef043dd024f/68747470733a2f2f7472617669732d63692e6f72672f546f6d5772696768742f4576656e74696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TomWright/Eventing)[![Total Downloads](https://camo.githubusercontent.com/e3226b39f6575c67bbfc657be827d3a19cb256bf70538490198d18ecf7548f68/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f6576656e74696e672f642f746f74616c2e737667)](https://packagist.org/packages/tomwright/eventing)[![Latest Stable Version](https://camo.githubusercontent.com/c1c1e7aa94672829fff03a26b965d1a05f30b605bf139df5910902e7bd894d3f/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f6576656e74696e672f762f737461626c652e737667)](https://packagist.org/packages/tomwright/eventing)[![Latest Unstable Version](https://camo.githubusercontent.com/64372499a3c0a5b558f11c04a217c1967d6e90fa68f4749e1ad655e4e3e5f581/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f6576656e74696e672f762f756e737461626c652e737667)](https://packagist.org/packages/tomwright/eventing)[![License](https://camo.githubusercontent.com/41dbdf5653ed86b1fa7d79042d9e7ca46107465f1a5c8c313f47a8c34afec7d4/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f6576656e74696e672f6c6963656e73652e737667)](https://packagist.org/packages/tomwright/eventing)

Usage
-----

[](#usage)

You need an Event and an EventHandler.

Let's say we have an event class stored in app/eventing/event/UserWasRegistered.php.

```
namespace App\Eventing\Event;

class UserWasRegistered extends \TomWright\Eventing\Event\Event
{
	protected $userId;

    public function setUserId($userId)
    {
    	$this->userId = $userId;
    }

    public function getUserId()
    {
    	return $this->userId;
    }
}
```

Let's also assume we have an event handler class stored in app/eventing/handler/UserWasRegisteredHandler.php.

```
namespace App\Eventing\Handler;

class UserWasRegisteredHandler implements \TomWright\Eventing\Listener\ListenerInterface
{
    public function handle(\TomWright\Eventing\Event\EventInterface $event)
    {
    	echo "User #{$event->getUserId()} has been registered.";
    }
}
```

Now we need to add an Event Handler/Listener namespace so as the EventBus knows where to look for the handlers.

```
$bus = \TomWright\Eventing\EventBus::getInstance();
$bus->addListenerNamespace('\\App\\Eventing\\Handler');
```

Now whenever we register a new user, all we have to do is the following:

```
$bus = \TomWright\Eventing\EventBus::getInstance();
$event = new \App\Eventing\Event\UserWasRegistered();
$event->setUserId(123);
$bus->dispatch($event);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Unknown

Total

1

Last Release

3705d ago

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/tomwright-eventing/health.svg)

```
[![Health](https://phpackages.com/badges/tomwright-eventing/health.svg)](https://phpackages.com/packages/tomwright-eventing)
```

###  Alternatives

[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

31252.7k5](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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