How to intercept apache raw response packet before sent with PHP Slim?

I am building web server like proxy with PHP Slim

and Main functionality is logging all response packet from apache daemon.
but I want intercept response packet from Apache daemon with PHP slim

As I tested, I could modify only PHP Slim layer not All raw packet

so I can’t modify and control all HTTP Raw packet.

How could I solve it with using PHP slim only?