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

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

internetpixels/event-manager
============================

Handle events in your application with this PHP library

1.0.0(8y ago)21.6kPHPPHP &gt;=7.1

Since Jan 2Pushed 8y agoCompare

[ Source](https://github.com/internetpixels/event-manager)[ Packagist](https://packagist.org/packages/internetpixels/event-manager)[ RSS](/packages/internetpixels-event-manager/feed)WikiDiscussions master Synced 3d ago

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

Event manager for PHP
=====================

[](#event-manager-for-php)

Handle events and triggers in your application with this PHP library. No hassle with the correct hooking time of listeners, simple set the priority.

This is a open-source library. Please consider a link to this repository when you're actively using it.

[![License](https://camo.githubusercontent.com/cf76db379873b010c163f9cf1b5de4f5730b5a67/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f6d69742f6d69742e7376673f763d313032)](https://github.com/internetpixels/event-manager)[![Build Status](https://camo.githubusercontent.com/0c4fc4737743631332668340c3af37301ed3296c338b533c22d941d4fde00817/68747470733a2f2f7472617669732d63692e6f72672f696e7465726e6574706978656c732f6576656e742d6d616e616765722e737667)](https://travis-ci.org/internetpixels/event-manager)[![Maintainability](https://camo.githubusercontent.com/2c75ae29a6c1d506ae1f5e8d60d08a46764caf105d750204f0a5f7de8189784e/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32616363613364633364653366666465663338382f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/internetpixels/event-manager/maintainability)

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

[](#installation)

Install this PHP event manager by using composer:

```
composer require internetpixels/event-manager

```

Basic examples
--------------

[](#basic-examples)

### Register an event

[](#register-an-event)

Before you're able to use a new event, you'll need to register it. Find a logical place in your application, preferably in the start of the runtime.

The event needs to be registered before you can add any listeners to it, otherwise this library will throw an exception!

```
$eventManager = new EventManager();

$event = new EventEntity();
$event->setKey( 'test.event.after.post' );

$eventManager->registerEvent( $event );

```

### Register a listener

[](#register-a-listener)

After the event is added, you can "hook" new listeners to the event. This means, when the event is triggered, it will call all triggers with their given priority.

Priority 1 is the most important and the default priority is 50. The event manager sorts the listeners automatically, so it doesn't matter in what order you add the listeners to the event manager.

A listener can only have 1, required, callback method. This method will be called once the event is executed.

```
$listener = new EventListenerEntity();
$listener->setEventKey( 'test.event.after.post' );
$listener->setPriority( 20 );
$listener->setCallback( [ $this, 'eventCallback' ] );

$eventManager->registerListener( $listener );

```

### Callback example

[](#callback-example)

Each listener has a callback method, a basic callback method may look like this in your application. You should receive the `$params` array, and return them as an array for further usage.

```
public function eventCallback( $params = null ) {
	// TODO: Do something with the parameters
	var_dump($params);

	return $params;
}

```

### Execute the event

[](#execute-the-event)

When your setup is completed with the event and at least one listener, you can execute the event in your application. This will trigger all listener(s) with their given priority.

```
$eventManager->executeEvent( 'test.event.after.post' )

```

Using the events as filters
---------------------------

[](#using-the-events-as-filters)

You can use the events as filters. The registration process is nearly the same as a normal event, you only have to enable parameters on the event registration and add them in the `executeEvent` method.

The `executeEvent` method will return the parameters.

```
$event = new EventEntity();
$event->setParams( true );
$event->setKey( 'test.event.after.post' );

$eventManager->registerEvent( $event );

$executed = $eventManager->executeEvent( 'test.event.after.post', [
	'first parameter value',
] );

var_dump( $executed );

```

The parameters are now available in the event callback `$params` array.

### Multiple params in execution

[](#multiple-params-in-execution)

It is very easy to add more parameters in your execution. Just add new array values in the execute method.

```
$executed = $eventManager->executeEvent( 'test.event.after.post', [
	'first parameter value',
	'second parameter value',
	'third parameter value',
] );

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3054d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40e46fe516650f2bafa6728d8d4ab3da4b6570d29772fbeef6798613e49843d8?d=identicon)[Petervw](/maintainers/Petervw)

---

Top Contributors

[![Petervw](https://avatars.githubusercontent.com/u/7113270?v=4)](https://github.com/Petervw "Petervw (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dg/composer-frontline

Composer Frontline: updates all the version constraints in the composer.json file to latest version

288.4k1](/packages/dg-composer-frontline)

PHPackages © 2026

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