sunhao fe08a6fbcc 初始 | il y a 5 ans | |
---|---|---|
.. | ||
Debug | il y a 5 ans | |
DependencyInjection | il y a 5 ans | |
Tests | il y a 5 ans | |
.gitignore | il y a 5 ans | |
CHANGELOG.md | il y a 5 ans | |
ContainerAwareEventDispatcher.php | il y a 5 ans | |
Event.php | il y a 5 ans | |
EventDispatcher.php | il y a 5 ans | |
EventDispatcherInterface.php | il y a 5 ans | |
EventSubscriberInterface.php | il y a 5 ans | |
GenericEvent.php | il y a 5 ans | |
ImmutableEventDispatcher.php | il y a 5 ans | |
LICENSE | il y a 5 ans | |
README.md | il y a 5 ans | |
composer.json | il y a 5 ans | |
phpunit.xml.dist | il y a 5 ans |
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.phar install
$ phpunit