Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Loïc Faugeron:
The Ultimate Developer Guide to Symfony - Event Dispatcher
Feb 11, 2016 @ 09:29:42

In a recent post to his site Loïc Faugeron has posted the second in his series of in-depth looks at a specific component of the Symfony framework. In this new article he provides the "ultimate developer guide" to the EventDispatcher component.

In this guide we explore the standalone libraries (also known as "Components") provided by Symfony to help us build applications. We've already seen [the] [HTTP Kernel and HTTP Foundation](https://gnugat.github.io/2016/02/03/ultimate-symfony-http-kernel.html). We're now about to check Event Dispatcher, then in the next articles we'll have a look at: routing and YAML, dependency injection and console [functionality].

He starts off with a basic introduction to the EventDispatcher component, describing the EventDispatcherInterface and how to implement the class with simple listeners and dispatch handling. He also shows how to extend this and create Event class implementations. Following this he circled back around to the HttpKernel component and describes how it makes heavy use of events in things like routing, controller requests, exceptions and views. For each he gives a bit of example code defining listeners that perform simple actions when executed.

tagged: ultimate developer guide symfony component eventdispatcher tutorial

Link: https://gnugat.github.io/2016/02/10/ultimate-symfony-event-dispatcher.html