sunhao fe08a6fbcc 初始 | 5 years ago | |
---|---|---|
.. | ||
Debug | 5 years ago | |
DependencyInjection | 5 years ago | |
Tests | 5 years ago | |
.gitignore | 5 years ago | |
CHANGELOG.md | 5 years ago | |
ContainerAwareEventDispatcher.php | 5 years ago | |
Event.php | 5 years ago | |
EventDispatcher.php | 5 years ago | |
EventDispatcherInterface.php | 5 years ago | |
EventSubscriberInterface.php | 5 years ago | |
GenericEvent.php | 5 years ago | |
ImmutableEventDispatcher.php | 5 years ago | |
LICENSE | 5 years ago | |
README.md | 5 years ago | |
composer.json | 5 years ago | |
phpunit.xml.dist | 5 years ago |
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