Skip to content

Instantly share code, notes, and snippets.

@BinaryKitten
Created October 9, 2012 12:21
Show Gist options
  • Save BinaryKitten/3858485 to your computer and use it in GitHub Desktop.
Save BinaryKitten/3858485 to your computer and use it in GitHub Desktop.
Module as Route in ZF2
<?php
namespace Application;
use Zend\Mvc\MvcEvent;
use Zend\Http\PhpEnvironment\Response;
class Module extends Response {
//BootstrapListenerInterface
public function onBootstrap(MvcEvent $event) {
$eventManager = $event->getTarget()->getEventManager();
$this->setContent('Hello World');
$eventManager->attach(MvcEvent::EVENT_ROUTE, array($this, 'onDispatch'), 1000);
}
public function onDispatch(MvcEvent $event) {
return $this->send();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment