PHPackages                             gplanchat/php-event-manager - 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. gplanchat/php-event-manager

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

gplanchat/php-event-manager
===========================

A basic event manager

1.1.0(11y ago)52994PHPPHP &gt;=5.4

Since Dec 4Pushed 11y ago1 watchersCompare

[ Source](https://github.com/gplanchat/php-event-manager)[ Packagist](https://packagist.org/packages/gplanchat/php-event-manager)[ RSS](/packages/gplanchat-php-event-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

php-event-manager
=================

[](#php-event-manager)

PHP events management library.

Description
-----------

[](#description)

The event emitting manager let you implement callback-based event management, for implementing modular code or to make easier class reuse.

Event-based programming is currently available natively into multiple languages and brings some new ways of writing code. Having in mind that this pattern should be used to make code easier to maintain, this pattern should not be used in all cases, especially where other patterns are simpler to implement.

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

[](#requirements)

- PHP &gt;= 5.4.0

Unit testing
------------

[](#unit-testing)

Run the following command to launch PHPUnit unit tests under the package root directory :

```
$ phpunit --strict --configuration build/phpunit.xml

```

Examples
--------

[](#examples)

You may find the following code examples useful. Some more examples could be found in the unit tests suite in the tests/ folder.

### Basic usage with SharedEventEmitter

[](#basic-usage-with-sharedeventemitter)

```
$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e) {
    // Your event code comes here...
});

// ...

// Calling the event
$eventEmitter->emit(new Event('ready'));

```

### Passing datas into the Event

[](#passing-datas-into-the-event)

```
$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e) {
    // Your event code comes here...
});

// ...

// Calling the event
$eventEmitter->emit(new Event('ready', [
    'my_object' => new stdClass
]));

```

### Passing datas into the Event, with a defined priority for the callback

[](#passing-datas-into-the-event-with-a-defined-priority-for-the-callback)

```
$priority = 100;
$callback = function(Event $e) {
    // Your event code comes here...
};

$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], $callback, $priority);

// ...

// Calling the event
$eventEmitter->emit(new Event('ready', [
    'my_object' => new stdClass
]));

```

### Passing datas during event emitting

[](#passing-datas-during-event-emitting)

```
$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e, $isError, $object) {
    // Your event code comes here...
});

// ...

// Calling the event,
$eventEmitter->emit(new Event('ready'), false, new stdClass);

```

### Implement the EventEmitterInterface interface to build your own event emitters

[](#implement-the-eventemitterinterface-interface-to-build-your-own-event-emitters)

You may implement this event emitter manager for adding event management to existing frameworks.

```
class Application
    extends Foo\Framework\ApplicationAbstract
    implements EventEmitterInterface
{
    use EventEmitterTrait;

    public function bootstrap()
    {
        // Bootstrap the instance...

        // emit the 'bootstrap' event, when your method has finished the basic bootstrapping
        $this->emit(new Event('bootstrap', ['application' => $this]));

        return $this;
    }
}

//...

// Registering a callback for the event 'bootstrap'
$eventEmitter->on(['bootstrap'], function(Event $e) {
    // Your event code comes here...
});

//...

// Your caller code looks like this :
$app = new Application();
$app->bootstrap();

```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~558 days

Total

2

Last Release

4346d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/144109625f8029112d56f43d08120cf03a0918ea3b4fd59ab53f09b02f630b00?d=identicon)[gplanchat](/maintainers/gplanchat)

---

Top Contributors

[![gplanchat](https://avatars.githubusercontent.com/u/152367?v=4)](https://github.com/gplanchat "gplanchat (20 commits)")[![steverhoades](https://avatars.githubusercontent.com/u/1146668?v=4)](https://github.com/steverhoades "steverhoades (1 commits)")

### Embed Badge

![Health badge](/badges/gplanchat-php-event-manager/health.svg)

```
[![Health](https://phpackages.com/badges/gplanchat-php-event-manager/health.svg)](https://phpackages.com/packages/gplanchat-php-event-manager)
```

###  Alternatives

[bigwhoop/sentence-breaker

Sentence boundary disambiguation (SBD) - or sentence breaking - library written in PHP.

42132.3k](/packages/bigwhoop-sentence-breaker)[j0k3r/graby-site-config

Graby site config files

23365.8k3](/packages/j0k3r-graby-site-config)

PHPackages © 2026

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