symnedi/event-dispatcher

This package is abandoned and no longer maintained. The author suggests using the contributte/event-dispatcher package instead.

Symfony\EventDispatcher integration to Nette.

v0.4.0 2016-07-25 19:45 UTC

This package is auto-updated.

Last update: 2022-01-27 10:58:29 UTC


README

Build Status Quality Score Code Coverage Downloads Latest stable

Integration of Symfony\EventDispatcher into Nette\DI.

Install

$ composer require symnedi/event-dispatcher

Register the extension in config.neon:

extensions:
	- Symnedi\EventDispatcher\DI\EventDispatcherExtension

Usage

There are 3 important parts using EventDispatcher:

  • Event
  • EventSubscriber
  • EventDispatcher

Event is value object, it simply stores data we use - e.g. user email and password.

EventSubscriber listens to certain event and invokes some action, when that happens - when user logs in.

EventDispatcher invokes the event in the place where it happens - in the login form just after the login method.

To see the real code in practise, there is example section with both Event and EventSubscriber.

Also you can find AppEvents.php that basically lists all used events. It's not necessary for the starters, just convenient in huge applications.

For more details, check Symfony documentation, or this very nice presentation with real-life examples.

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.