Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created February 20, 2013 22:42
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/5000377 to your computer and use it in GitHub Desktop.
Save phalcon/5000377 to your computer and use it in GitHub Desktop.
<?php
$loader = new Phalcon\Loader();
$loader->registerNamespaces(array(
'Application\Backend\Controllers' => '../app/backend/controllers/',
'Application\Frontend\Controllers' => '../app/frontend/controllers/',
))->register();
$di = new \Phalcon\DI\FactoryDefault();
$di->set('router', function() {
$router = new \Phalcon\Mvc\Router\Annotations(false);
$router->addModuleResource('frontend', 'Application\Backend\Controllers\Products', '/api/products');
return $router;
});
$application = new \Phalcon\Mvc\Application();
$application->setDI($di);
$application->registerModules(array(
'frontend' => //...
));
try {
echo $application->handle()->getContent();
} catch (Exception $e) {
var_dump($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment