$app = new \Phalcon\Mvc\Micro();
$eventsManager = new \Phalcon\Events\Manager();
$eventsManager->attach('dispatch:beforeExecuteRoute',
function($event, $dispatcher, $exception) {
throw new \Phalcon\Exception('Fired up!');
});
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);
$app->setService('dispatch', $dispatcher);
public function beforeExecuteRoute()
{
$this->view->setVar('param', 'ExecuteRoute');
}