How can I execute code after the response is already sent to browser?

I want to do some logging when the response to client is already sent, so the browser is not blocked. How can I do that in Phalcon?

I was thinking about attaching to events, but application:afterHandleRequest event is fired before the HTML is sent, not after.

Hi dude check application:beforeSendResponse is the last event called source



258

I checked that event and, unfortunetely, it does not suit me, because it is fired before sending the response (which event's name says)

Hi dude check application:beforeSendResponse is the last event called source

well I think the only solutions is make your own application extending \Phalcon\Mvc\Application and overwrite handle method



258
edited 21d ago

just ended up with the following code in my base controller, and attaching to the event in appropriate place

public function __destruct() { $this->eventsManager->fire('myapp:finalize', $this); }