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 a9a0f420e2 merged 2.1
2012-09-10 12:54:04 +02:00
..
Debug fixed CS 2012-07-09 14:54:20 +02:00
Tests [EventDispatcher] Adding IteratorAggregate to GenericEvent 2012-08-15 14:38:32 -07:00
.gitignore [Components] Tests/Autoloading fixes 2012-05-01 17:51:41 +02:00
CHANGELOG.md [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
composer.json merged 2.1 2012-09-10 12:54:04 +02:00
ContainerAwareEventDispatcher.php Fixing email 2012-05-26 09:48:33 +02:00
Event.php fixed CS 2011-12-18 14:36:25 +01:00
EventDispatcher.php fixed phpdoc @param alignment 2012-05-15 22:19:31 +02: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 [EventDispatcher] Adding IteratorAggregate to GenericEvent 2012-08-15 14:38:32 -07:00
ImmutableEventDispatcher.php [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist [Components] Tests/Autoloading fixes 2012-05-01 17:51:41 +02:00
README.md [Components] Tests/Autoloading fixes 2012-05-01 17:51:41 +02:00

EventDispatcher Component

EventDispatcher implements a lightweight version of the Observer design pattern.

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:

phpunit

If you also want to run the unit tests that depend on other Symfony Components, install dev dependencies before running PHPUnit:

php composer.phar install --dev