Skip to main content

Posts

Showing posts with the label Symfony

Symfony Tutorials: Event Dispatcher

Symfony EventDispatcher is object which interacts with different set of objects when certain event happens. To illustrate Event Dispatcher definition let’s consider the online shopping website example. suppose  you want to purchase a mobile f rom online shopping website , but unfortunately that mobile is out of stock. Then you subscribe into online shopping website for this mobile availability. When mobile comes in stock, online shopping website notifies you about mobile phone’s availability via email. In above scenario you are the Event Listener / Event Subscriber mobile availability is Event online shopping website is Event Dispatcher . Symfony EventDispatcher works in same manner.for example, whenever there is HTTP request, Kernel creates a request object and it dispatches an event kernel.request . Whoever subscribes to kernel.request event gets notified. So here you might be having few questions in my mind. What is Event?

Subscribe for latest tutorial updates

* indicates required