|
|
há 10 anos atrás | |
|---|---|---|
| .. | ||
| Debug | há 10 anos atrás | |
| DependencyInjection | há 10 anos atrás | |
| Tests | há 10 anos atrás | |
| CHANGELOG.md | há 10 anos atrás | |
| ContainerAwareEventDispatcher.php | há 10 anos atrás | |
| Event.php | há 10 anos atrás | |
| EventDispatcher.php | há 10 anos atrás | |
| EventDispatcherInterface.php | há 10 anos atrás | |
| EventSubscriberInterface.php | há 10 anos atrás | |
| GenericEvent.php | há 10 anos atrás | |
| ImmutableEventDispatcher.php | há 10 anos atrás | |
| LICENSE | há 10 anos atrás | |
| README.md | há 10 anos atrás | |
| composer.json | há 10 anos atrás | |
| phpunit.xml.dist | há 10 anos atrás | |
The Symfony EventDispatcher component implements the Mediator pattern in a simple and effective way to make your projects truly extensible.
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
$dispatcher = new EventDispatcher();
$dispatcher->addListener('event_name', function (Event $event) {
// ...
});
$dispatcher->dispatch('event_name');
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/EventDispatcher/
$ composer install
$ phpunit