meh
<?php
use Phalcon\Mvc\Application;
error_reporting(E_ALL);
(new \Phalcon\Debug())->listen();
define('APPLICATION_PATH', dirname(dirname(__FILE__)) . '/apps');
/**
* Include services
*/
require __DIR__ . '/../config/loader.php';
require __DIR__ . '/../config/services.php';
require __DIR__ . '/../config/assets.php';
/**
* Handle the request
*/
$application = new Application($di);
/**
* Include modules
*/
require __DIR__ . '/../config/modules.php';
require __DIR__ .'/../config/routes.php';
echo $application->handle()->getContent();
<?php
$router = $di->get("router");
foreach ($application->getModules() as $key => $module) {
$namespace = sprintf("Learnflux\%s\Controllers", ucfirst($key));
$router->add('/'.$key.'/:params', array(
'namespace' => $namespace,
'module' => $key,
'controller' => 'index',
'action' => 'index',
'params' => 1
))->setName($key);
$router->add('/'.$key.'/:controller/:params', array(
'namespace' => $namespace,
'module' => $key,
'controller' => 1,
'action' => 'index',
'params' => 2
));
$router->add('/'.$key.'/:controller/:action/:params', array(
'namespace' => $namespace,
'module' => $key,
'controller' => 1,
'action' => 2,
'params' => 3
));
}
$modroutes = glob(APPLICATION_PATH."/*/config/routes.php");
foreach($modroutes as $route)
{
include_once $route;
}
$di['router'] = function () {
$router = new Router();
$router->setDefaultModule('frontend');
$router->removeExtraSlashes(true);
return $router;
};
$di->set('dispatcher', function() use ($di) {
$dispatcher = new Phalcon\Mvc\Dispatcher();
$dispatcher->setDefaultNamespace('MyApp\Frontend\Controllers');
return $dispatcher;
},true);
you are welcome.