flightphp / core

An extensible micro-framework for PHP
https://docs.flightphp.com
MIT License
2.6k stars 407 forks source link

added ability to convert the response body #571

Closed n0nag0n closed 3 months ago

n0nag0n commented 3 months ago

This will allow you to minify, gzip, whatever you'd like to do with the response body.

Flight::response()->addResponseBodyCallback(function($body) {
    return gzencode($body, 9);
});
n0nag0n commented 3 months ago

Added documentation here. https://docs.flightphp.com/learn/responses#running-a-callback-on-the-response-body