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