Last active
February 6, 2016 22:33
-
-
Save odino/bf4c7468cba8b16c6493 to your computer and use it in GitHub Desktop.
This file contains 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 | |
class VersioningHook | |
{ | |
public function beforeSendingResponse(Req $request, Res $response) | |
{ | |
$version = $request->headers->get('version'); | |
$eventName = "api-v$version.response" | |
$this->eventDispatcher->dispatch($eventName, array( | |
'request' => $request, | |
'response' => $response, | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment