Skip to content

Instantly share code, notes, and snippets.

@hello-josh
Last active November 9, 2015 17:10
Show Gist options
  • Save hello-josh/29617a38ce39456ecbbc to your computer and use it in GitHub Desktop.
Save hello-josh/29617a38ce39456ecbbc to your computer and use it in GitHub Desktop.
Functional replacement for App\Action\IndexAction from http://www.sitepoint.com/build-nasa-photo-gallery-zend-expressive/
<?php
function index_action(TemplateRendererInterface $templateRenderer) {
return function (ServerRequestInterface $request,
ResponseInterface $response,
callable $next = null) use ($templateRenderer) {
$html = templateRenderer->render('app::index');
$response->getBody()->write($html);
return $response->withHeader('Content-Type', 'text/html');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment