Adding HTTP compression to your application could never have been easier!
Just insert the following two lines to your configuration array, and PHP will do the rest.
'onBeginRequest'=>create_function('$event', 'return ob_start("ob_gzhandler");'), 'onEndRequest'=>create_function('$event', 'return ob_end_flush();'),
An overview about this:
create_functionwill create lambda functions in runtime, so you don't have to worry about external files. It'll take the parameter list and the internal code, respectively, and return the newly added function name, which will serve here as callbacks.
onEndRequestwill trigger attaching callbacks to application events.
(If you need additional functionality, you may want to create a separate file for these functions.)