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 51c6d7696c Merge branch '2.3'
* 2.3:
  fixed phpdoc
  Fix some annotates
  [FrameworkBundle] made sure that the debug event dispatcher is used everywhere
  [HttpKernel] remove unneeded strtoupper
  updated the composer install command to reflect changes in Composer

Conflicts:
	src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
2013-09-19 11:47:34 +02:00
..
Debug fixed CS 2012-07-09 14:54:20 +02:00
Tests merged branch drak/edaware2 (PR #7852) 2013-09-13 17:13:26 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
composer.json updated version to 2.4 2013-05-16 09:54:39 +02: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 [2.3][EventDispatcher] Make events lighter 2013-09-13 17:13:25 +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 Merge branch '2.1' 2013-01-04 18:02:19 +01:00
ImmutableEventDispatcher.php [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
LICENSE updated license year 2013-01-04 17:59:43 +01:00
phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01:00
README.md updated the composer install command to reflect changes in Composer 2013-09-18 09:27:26 +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:

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