Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created June 28, 2013 00:05
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 phalcon/5881459 to your computer and use it in GitHub Desktop.
Save phalcon/5881459 to your computer and use it in GitHub Desktop.
<?php
class IndexController
{
public function indexAction()
{
echo '<h2>Running ' . __METHOD__ . '</h2>';
}
}
$di = new Phalcon\DI\FactoryDefault();
$di['view'] = function() {
$view = new Phalcon\Mvc\View();
return $view;
};
$di['router'] = function() {
$router = new Phalcon\Mvc\Router();
$router->setDefaultModule('frontend');
return $router;
};
$application = new Phalcon\Mvc\Application($di);
// Register the installed modules
$application->registerModules(
array(
'frontend' => function($di) {
echo '<h1>Initializing frontend</h1>';
},
'backend' => function($di) {
echo '<h1>Initializing backend</h1>';
}
)
);
echo $application->handle()->getContent();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment