Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created June 14, 2012 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2929666 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2929666 to your computer and use it in GitHub Desktop.
Defining an event listener that adds a HTML comment to the Response body - http://www.symfonycentral.com
<?php
require_once __DIR__.'/../vendor/.composer/autoload.php';
// ... etc
use Symfony\Component\EventDispatcher\EventDispatcher;
$dispatcher = new EventDispatcher();
$dispatcher->addListener('response', function (Simplex\ResponseEvent $event) {
$response = $event->getResponse();
$response->setContent($response->getContent().'<!-- ' . time() . ' -->');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment