Skip to content

Instantly share code, notes, and snippets.

@odino
Last active February 6, 2016 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save odino/bf4c7468cba8b16c6493 to your computer and use it in GitHub Desktop.
Save odino/bf4c7468cba8b16c6493 to your computer and use it in GitHub Desktop.
<?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