The MVC layer of Zend Framework 2 also incorporates and utilizes a custom Zend\EventManager\Event implementation located at Zend\Mvc\ResponseSender\SendResponseEvent. This event allows listeners to update the response object, by setting headers and content.
The methods it defines are:
Currently, three listeners are listening to this event at different priorities based on which listener is used most.
Because all these listeners have negative priorities, adding your own logic to modify Response object is easy: just add a new listener without any priority (it will default to 1) and it will always be executed first.
This event is executed when MvcEvent::FINISH event is triggered, with a priority of -10000.
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.