PHP Classes
elePHPant
Icontem

PHP Event Mediator: Emit and listen to events using a mediator object

Recommend this page to a friend!
  Info   View files View files (36)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-08-01 (28 days ago) RSS 2.0 feedNot enough user ratingsTotal: 201 This week: 2All time: 7,786 This week: 530Up
Version License PHP version Categories
event-mediator 2.0.0GNU General Publi...7.0Libraries, Design Patterns, PHP 7, Tr...
Description Author

This package allows to emit and listen to events using a mediator object.

It provides a class that implements the mediator design pattern to perform operations with objects of classes that abstract emitted events and listeners that process those events when they happened.

Currently it can add a listener to a given event by name, or add a subscriber, get the listeners a given event name, check if a given event name has listeners, remove a listener to a given event, remove a subscriber and trigger a event.

Innovation Award
PHP Programming Innovation award nominee
February 2016
Number 9


Prize: One downloadable e-book of choice by O'Reilly
The mediator pattern allows applications to manage interaction between different types of objects using a single object.

This package can manage events and listeners using a mediator design pattern object to manage all the involved types of objects.

Manuel Lemos
Picture of Michael Cummings
  Performance   Level  
Name: Michael Cummings <contact>
Classes: 3 packages by
Country: United States United States
Age: ???
All time rank: 2676342 in United States United States
Week rank: 234 Up21 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Details

Event-Mediator

SensioLabsInsight<br/><br/> Travis-ci: Build Status<br/> Scrutinizer-ci: Scrutinizer Code Quality<br/> Coveralls: Coverage Status

A general event mediator (dispatcher) with minimal dependencies so it is easy to drop in and use.

Installing

The recommended way to install Event-Mediator is using Composer from Packagist with:

composer require dragonrun1/event-mediator

You can also get it as a zip file from GitHub.

Licensing

Licensing information can be found in the LICENSE file.

Introduction

Most people might know event mediator as an event dispatcher instead and both names would have worked. The reason I choose to call it a mediator is it follows the mediator pattern. For those of you that are familiar with Symfony 2 and it's EventDispatcher component then Event Mediator started out as basically a drop in replace for it without the (IMHO) huge dependence overhead often seen with Symfony components. Event Mediator has since grown into something better since then I think.

To get a better understanding about Event-Mediator and how you might use it check out Understanding Event-Mediator

Changes

* Started new 2.0-dev branch with many BC breaking changes. * The 1.0 series is now end of life and all application developers should update to newer 2.0 versions ASAP. If your code only used the listener methods the move should be easy with few changes needed. If application uses any of the subscriber stuff you will need to update the returned event array to reflect the new expected format.

For a more complete understand of the changes refer to the commit messages and new code.

  Files folder image Files  
File Role Description
Files folder image.phpspec (2 files)
Files folder imagedocs (1 file)
Files folder imagespecs (1 directory)
Files folder imagesrc (10 files)
Accessible without login Plain text file .coveralls.yml Data Auxiliary data
Accessible without login Plain text file .mailmap Data Auxiliary data
Accessible without login Plain text file .php_cs Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file behat.yml Data Auxiliary data
Accessible without login Plain text file bootstrap.php Conf. Configuration script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpdoc.dist.xml Data Auxiliary data
Accessible without login Plain text file phpspec.yml.dist Data Auxiliary data
Accessible without login Plain text file phpspec_coverage.yml Data Auxiliary data
Accessible without login Plain text file README.md Data Description
Accessible without login Plain text file ruleset.xml Data Auxiliary data

  Files folder image Files  /  .phpspec  
File Role Description
  Accessible without login Plain text file class.tpl Data Auxiliary data
  Accessible without login Plain text file specification.tpl Data Auxiliary data

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Plain text file UnderstandingEventMediator.md Doc. Documentation

  Files folder image Files  /  specs  
File Role Description
Files folder imageSpec (9 files)

  Files folder image Files  /  specs  /  Spec  
File Role Description
  Accessible without login Plain text file EventSpec.php Test Unit test script
  Accessible without login Plain text file EventTraitSpec.php Test Unit test script
  Accessible without login Plain text file MediatorSpec.php Test Unit test script
  Accessible without login Plain text file MockEventTrait.php Test Unit test script
  Accessible without login Plain text file MockListener.php Test Unit test script
  Accessible without login Plain text file MockListenerInterface.php Test Unit test script
  Plain text file MockServiceSubscriber.php Class Class source
  Accessible without login Plain text file MockSubscriber.php Test Unit test script
  Accessible without login Plain text file PimpleContainerMediatorSpec.php Test Unit test script

  Files folder image Files  /  src  
File Role Description
  Plain text file AbstractContainerMediator.php Class Class source
  Plain text file ContainerMediatorInterface.php Class Class source
  Plain text file Event.php Class Class source
  Plain text file EventInterface.php Class Class source
  Plain text file EventTrait.php Class Class source
  Plain text file Mediator.php Class Class source
  Plain text file MediatorInterface.php Class Class source
  Plain text file PimpleContainerMediator.php Class Class source
  Plain text file ServiceSubscriberInterface.php Class Class source
  Plain text file SubscriberInterface.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:201
This week:2
All time:7,786
This week:530Up
User Comments (1)
Really needs some docs.
6 months ago (Colin McKinnon)
42%StarStarStar