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

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

atelierspierrot/event-manager
=============================

The events manager package of Les Ateliers Pierrot.

v1.0.1(10y ago)136Apache-2.0HTMLPHP &gt;=5.4.0

Since Mar 2Pushed 10y ago1 watchersCompare

[ Source](https://github.com/atelierspierrot/event-manager)[ Packagist](https://packagist.org/packages/atelierspierrot/event-manager)[ Docs](http://github.com/atelierspierrot/event-manager)[ RSS](/packages/atelierspierrot-event-manager/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Event manager
=============

[](#event-manager)

[![Code Climate](https://camo.githubusercontent.com/9780b9d9fd5b67df6b0ba0cc215f52f6f9ddb69c6f5f2c3e48bcfefb26628cbd/687474703a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6174656c6965727370696572726f742f6576656e742d6d616e616765722f6261646765732f6770612e737667)](http://codeclimate.com/github/atelierspierrot/event-manager)[![documentation](https://camo.githubusercontent.com/be7adb4ffdc11ba4b480fe936a1e0d23e2c6b3a70ffea72fa4004a30e74e1bae/687474703a2f2f696d672e6174656c696572732d70696572726f742d7374617469632e66722f726561642d7468652d646f632e737667)](http://docs.ateliers-pierrot.fr/event-manager/)The events manager package of Les Ateliers Pierrot

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

[](#installation)

For a complete information about how to install this package and load its namespace, please have a look at [our *USAGE* documentation](http://github.com/atelierspierrot/atelierspierrot/blob/master/USAGE.md).

If you are a [Composer](http://getcomposer.org/) user, just add the package to the requirements of your project's `composer.json` manifest file:

```
"atelierspierrot/event-manager": "dev-master"

```

You can use a specific release or the latest release of a major version using the appropriate [version constraint](http://getcomposer.org/doc/01-basic-usage.md#package-versions).

Please note that this package depends on the externals [PHP Patterns](https://github.com/atelierspierrot/patterns)and [PHP Library](https://github.com/atelierspierrot/library).

SPL interfaces
--------------

[](#spl-interfaces)

As a reminder, the [SPL observer objects](http://php.net/manual/en/spl.misc.php)are:

```
interface SplObserver {
    abstract public void update ( SplSubject $subject )
}

interface SplSubject {
    abstract public void attach ( SplObserver $observer )
    abstract public void detach ( SplObserver $observer )
    abstract public void notify ( void )
}

```

Basics
------

[](#basics)

The basic idea of an *event propagation* system in PHP is quite simple:

- an object `A` can trigger some events during its life-cycle (to inform about an update for instance) ;
- an object `B` can adapt its properties or behaviors when the object `A`triggered an event (to keep the last value of a property of `A` for instance).

This can be implemented with an *observer/observable* system where the object `A`of the example above is *observable* while the `B` is its *observer*. Basically, the *observable* can be considered as an `SplSubject` as defined in the SPL interfaces above while the *observer* can be considered as an `SplObserver`. But the standard system (the SPL interfaces) only allows one single event to be triggered (or multiple events handled by the same method of the observer). We could use this basic definitions of event triggering but it forces the implementations to make a `switch` if the observable can trigger different events ...

The implementation in the library is ready to handle multiple events triggering allowing the observers to define the method that should be called when an event is fired. This method defaults to `handleEvent()`. To do so, the `SplObserver` interface is renamed (and rewritten) as the `ObserverInterface` and the `SplSubject`as the `ObservableInterface`. The event is a standalone object implementing the `EventInterface`:

```
interface ObserverInterface {
    abstract public void handleEvent ( EventInterface $event )
}

interface ObservableInterface {
    abstract public void attachObserver ( ObserverInterface $observer | array($object , $method) | $callback )
    abstract public void detachObserver ( ObserverInterface $observer | array($object , $method) | $callback )
    abstract public void triggerEvent ( $event_name )
}

interface EventInterface {
    abstract public ObservableInterface getSubject ()
    abstract public string getName ()
    abstract public void stopPropagation ()
    abstract public bool isPropagationStopped ()
}

```

Events manager
--------------

[](#events-manager)

A kernel object is defined to handle a set of events listeners/observers for a global application: the `EventManager` object. It introduces two new concepts: the *listeners* and the *subscribers*.

Basically, a *listener* is like an observer, it references itself to the object triggering the event it want to observe, a *subscriber* does not references itself to each events it wants to listen, but to the global events manager, that asks it the list of events it may listen:

```
interface EventListenerInterface
    extends ObserverInterface {}

interface EventSubscriberInterface {
    abstract public array getSubscribedEvents ()
}

```

Author &amp; License
--------------------

[](#author--license)

> Event Manager

>

> Copyright (c) 2015-2016 Pierre Cassat and contributors

> Licensed under the Apache 2 license.

>

> ---

> Les Ateliers Pierrot - Paris, France

>  -

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~305 days

Total

2

Last Release

3788d ago

### Community

Maintainers

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

---

Top Contributors

[![e-picas](https://avatars.githubusercontent.com/u/1021199?v=4)](https://github.com/e-picas "e-picas (25 commits)")

---

Tags

libraryevent manager

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/event-manager

The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.

6.1k501.1M115](/packages/doctrine-event-manager)[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

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