|
|
před 10 roky | |
|---|---|---|
| .. | ||
| Debug | před 10 roky | |
| DependencyInjection | před 10 roky | |
| Tests | před 10 roky | |
| CHANGELOG.md | před 10 roky | |
| ContainerAwareEventDispatcher.php | před 10 roky | |
| Event.php | před 10 roky | |
| EventDispatcher.php | před 10 roky | |
| EventDispatcherInterface.php | před 10 roky | |
| EventSubscriberInterface.php | před 10 roky | |
| GenericEvent.php | před 10 roky | |
| ImmutableEventDispatcher.php | před 10 roky | |
| LICENSE | před 10 roky | |
| README.md | před 10 roky | |
| composer.json | před 10 roky | |
| phpunit.xml.dist | před 10 roky | |
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