-
-
Save jaymecd/88b96d2f7b5e98b55c8c to your computer and use it in GitHub Desktop.
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 | |
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