Last active
August 10, 2016 13:32
-
-
Save danielsilver2/524aba806e1792e68eac58f5445371f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\Di\FactoryDefault; | |
use Phalcon\Mvc\Micro; | |
error_reporting(E_ALL); | |
define('APP_PATH', realpath('..')); | |
try { | |
/** | |
* @var FactoryDefault $di | |
*/ | |
$di = new FactoryDefault(); | |
/** | |
* Include Services | |
*/ | |
include APP_PATH . '/config/services.php'; | |
/** | |
* Call the autoloader service. We don't need to keep the results. | |
*/ | |
$di->getLoader(); | |
/** | |
* Starting the application | |
* Assign service locator to the application | |
*/ | |
$app = new Micro($di); | |
/** | |
* Include Application | |
*/ | |
include APP_PATH . '/app.php'; | |
/** | |
* Handle the request | |
*/ | |
$app->handle(); | |
} catch (\Exception $e) { | |
echo $e->getMessage() . '<br>'; | |
echo '<pre>' . $e->getTraceAsString() . '</pre>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$di->set('router', function() | |
{ | |
$router = new \Phalcon\Mvc\Router\Annotations(false); | |
$router->setDefaultNamespace('GIS\Controller'); | |
$router->addResource('User','/user'); | |
var_dump($router); | |
return $router; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace GIS\Controller; | |
use \Phalcon\Mvc\Controller; | |
/** | |
* @RoutePrefix("/user") | |
*/ | |
class UserController extends Controller | |
{ | |
/** | |
* @Get("/") | |
*/ | |
public function indexAction() | |
{ | |
return 'login'; | |
} | |
/** | |
* @Get("/hello", name="hello") | |
*/ | |
public function helloAction() | |
{ | |
return 'hello'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment