Skip to content

Instantly share code, notes, and snippets.

@sasezaki
Last active December 24, 2015 20:09
Show Gist options
  • Save sasezaki/6855431 to your computer and use it in GitHub Desktop.
Save sasezaki/6855431 to your computer and use it in GitHub Desktop.
<?php
class Module
{
public function onBootstrap($event)
{
$events = $event->getTarget()->getEventManager();
$events->attach(MvcEvent::EVENT_FINISH, function($e) {
if ($match = $e->getRouteMatch()) {
$params = $match->getParams();
if (isset($params['template'])) {
$path = getcwd().DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.$match->getMatchedRouteName().'.html';
file_put_contents($path, $e->getResponse()->getContent());
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment