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 3719c70870 updated minimum PHP version to 5.3.3
5.3.3 has some interesting fixes and this is the version used by
Redhat 6 and Debian 6
2012-05-07 10:29:11 +02:00
..
Debug [EventDispatcher] More logical positions for classes. 2012-04-04 22:03:00 +05:45
Tests [Components] Tests/Autoloading fixes 2012-05-01 17:51:41 +02:00
.gitignore [Components] Tests/Autoloading fixes 2012-05-01 17:51:41 +02:00
CHANGELOG.md [EventDispatcher] added CHANGELOG 2012-04-26 22:00:57 +02:00
composer.json updated minimum PHP version to 5.3.3 2012-05-07 10:29:11 +02:00
ContainerAwareEventDispatcher.php [EventDispatcher] Fixed edge case not covered by tests that generated E_NOTICES 2012-04-12 16:21:33 +05:45
Event.php fixed CS 2011-12-18 14:36:25 +01:00
EventDispatcher.php merged 2.0 2012-04-12 12:30:32 +02:00
EventDispatcherInterface.php fixed CS 2012-03-11 18:00:25 +01:00
EventSubscriberInterface.php merged 2.0 2011-12-13 16:12:53 +01:00
GenericEvent.php [EventDispatcher] Remove data property 2012-04-20 14:49:32 +05:45
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