Created
June 14, 2012 11:04
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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