Created
January 26, 2016 22:29
-
-
Save geggleto/856a8b291c62ccfe7c50 to your computer and use it in GitHub Desktop.
slim 3 gist 7
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 | |
$app->add(function ($req, $res, $next) { | |
//DO SOMETHING BEFORE THE REQUEST IS PROCESSED | |
$res = $next($req, $res); //PROCESS THE REQUEST | |
//DO SOMETHING AFTER THE REQUEST HAS BEEN PROCESSED | |
if ($res->getStatusCode() > 500) { | |
//Do something with a server error, maybe email someone or submit a bug report | |
} | |
//Continue rendering | |
return $res; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment