Skip to content

Instantly share code, notes, and snippets.

@acwoss
Created December 3, 2018 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acwoss/493303733e2167c610f82f4271e30a63 to your computer and use it in GitHub Desktop.
Save acwoss/493303733e2167c610f82f4271e30a63 to your computer and use it in GitHub Desktop.
$pipeline = new Pipeline([
function ($request, $next) {
if (!isset($request->getAttribute('user'))) {
return new Response(401, 'Sai daqui demônio!');
}
return $next->handle($request);
},
function ($request, $next) {
return new Response(200, 'Oi :D');
}
]);
$request = Request::fromGlobals();
echo $pipeline->handle($request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment