This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/EventDispatcher
Fabien Potencier f828aee7f7 Merge branch '2.4'
* 2.4:
  fixed various inconsistencies
  reduced recursion when building DumperPrefixCollection
  renamed variables - making next change more readable
  removing dead code.
  [ExpressionLanguage] added some tests for the built-in constant() function
  [ExpressionLanguage] added some documentation about functions
  [DomCrawler] Fixed filterXPath() chaining
  [DomCrawler] Fixed incorrect handling of image inputs
2014-02-11 14:52:21 +01:00
..
Debug [EventDispatcher] simplified code for TraceableEventDispatcher 2014-02-04 16:16:44 +01:00
DependencyInjection Merge branch '2.4' 2014-01-06 08:29:39 +01:00
Tests Merge branch '2.4' 2014-02-11 14:52:21 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [EventDispatcher] Added TraceableEventDispatcher from HttpKernel 2013-12-28 20:38:07 +01:00
composer.json [EventDispatcher] Added TraceableEventDispatcher from HttpKernel 2013-12-28 20:38:07 +01:00
ContainerAwareEventDispatcher.php Fixed most of the docblocks/unused namespaces 2012-12-19 08:09:49 +01:00
Event.php [EventDispatcher] fixed some phpdoc 2013-09-13 17:15:57 +02:00
EventDispatcher.php unify and fix callable phpdoc throughout symfony 2013-11-20 10:25:10 +01:00
EventDispatcherInterface.php fixed CS 2012-07-09 14:54:20 +02:00
EventSubscriberInterface.php fixed CS 2012-07-09 14:54:20 +02:00
GenericEvent.php removed observer pattern, in favour of mediator 2013-11-30 10:34:17 +01:00
ImmutableEventDispatcher.php [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
LICENSE update year on licenses 2014-01-07 08:19:25 -05:00
phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01:00
README.md [EventDispatcher] tweaked README 2013-11-30 10:35:04 +01:00

EventDispatcher Component

The Symfony2 EventDispatcher component implements the Mediator pattern in a simple and effective way to make your projects truly extensible.

use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;

$dispatcher = new EventDispatcher();

$dispatcher->addListener('event_name', function (Event $event) {
    // ...
});

$dispatcher->dispatch('event_name');

Resources

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/EventDispatcher/
$ composer.phar install
$ phpunit