mailgun-php/Mailgun/Symfony/Component/EventDispatcher
2013-07-17 22:48:12 -07:00
..
Debug Going to bed. Current state. 2013-07-17 22:48:12 -07:00
Tests Going to bed. Current state. 2013-07-17 22:48:12 -07:00
.gitignore Going to bed. Current state. 2013-07-17 22:48:12 -07:00
CHANGELOG.md Going to bed. Current state. 2013-07-17 22:48:12 -07:00
composer.json Going to bed. Current state. 2013-07-17 22:48:12 -07:00
ContainerAwareEventDispatcher.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
Event.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
EventDispatcher.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
EventDispatcherInterface.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
EventSubscriberInterface.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
GenericEvent.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
ImmutableEventDispatcher.php Going to bed. Current state. 2013-07-17 22:48:12 -07:00
LICENSE Going to bed. Current state. 2013-07-17 22:48:12 -07:00
phpunit.xml.dist Going to bed. Current state. 2013-07-17 22:48:12 -07:00
README.md Going to bed. Current state. 2013-07-17 22:48:12 -07: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 --dev
$ phpunit