Replace silex default event dispatcher with pimple aware event dispatcher
- PHP >= 5.5
- Pimple >= 3.0
composer require jowy/silex-pimple-aware-event-dispatcher
$app = new Application();
$app->register(new PimpleAwareEventDispatcherServiceProvider());
// register listener in DIC
$app["key"] = function () {
return new TestListener();
};
// register service locator id and method
$app["dispatcher"]->addListenerService("some.event", ["key", "method"]);
// dispatch event
$app["dispatcher"]->dispatch("some.event", new Event());
MIT, see LICENSE