mailgun-php/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher
2013-07-17 22:26:09 -05:00
..
Debug Missed the Vendor folder 2013-07-17 22:26:09 -05:00
Tests Missed the Vendor folder 2013-07-17 22:26:09 -05:00
.gitignore Missed the Vendor folder 2013-07-17 22:26:09 -05:00
CHANGELOG.md Missed the Vendor folder 2013-07-17 22:26:09 -05:00
composer.json Missed the Vendor folder 2013-07-17 22:26:09 -05:00
ContainerAwareEventDispatcher.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
Event.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
EventDispatcher.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
EventDispatcherInterface.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
EventSubscriberInterface.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
GenericEvent.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
ImmutableEventDispatcher.php Missed the Vendor folder 2013-07-17 22:26:09 -05:00
LICENSE Missed the Vendor folder 2013-07-17 22:26:09 -05:00
phpunit.xml.dist Missed the Vendor folder 2013-07-17 22:26:09 -05:00
README.md Missed the Vendor folder 2013-07-17 22:26:09 -05: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