Exemplo n.º 1
0
 /**
  * Bootstrap the micro application.
  * @return \Georeferencer\Application\Micro
  **/
 private function bootstrapApplication()
 {
     $this->app = new \Phalcon\Mvc\Micro();
     $this->app->setDI(new \Phalcon\DI\FactoryDefault());
     $this->app->setEventsManager(new \Phalcon\Events\Manager());
     return $this;
 }
Exemplo n.º 2
0
 public function execMicro()
 {
     $di = new FactoryDefault();
     $application = new Micro();
     $application->setDI($di);
     $this->load(APP_ROOT . 'apps/config/loadermicro.php', $di);
     return $application;
 }
Exemplo n.º 3
0
use Phalcon\Db\Adapter\Pdo\Mysql as MysqlAdapter;
use Phalcon\Config\Adapter\Ini as ConfigIni;
use Phalcon\Mvc\Micro\Collection as MicroCollection;
// Setup loader
$loader = new Loader();
$loader->registerDirs(array(__DIR__ . '/app/models/', __DIR__ . '/app/controllers/', __DIR__ . '/library/'))->register();
// Read the configuration
$config = new ConfigIni(__DIR__ . '/config/config.ini');
//Start DI
$di = new FactoryDefault();
$di->set('redis', function () {
    return new RedisTest();
}, true);
// Start Micro
$app = new Micro();
$app->setDI($di);
// Setup the database service
$app['db'] = function () use($config) {
    return new MysqlAdapter(array("host" => $config->database->host, "username" => $config->database->username, "password" => $config->database->password, "dbname" => $config->database->dbname, "charset" => $config->database->charset));
};
// Include controllers
$app['controllers'] = function () {
    return ['core' => true, 'user' => true, 'messages' => true];
};
// Authentication
//$app['auth'] = function() use ($app, $config) {
//    $auth = array();
//    $authorization = $app->request->getHeader("AUTHORIZATION");
//    if ($authorization) {
//        $cut = str_replace('Basic ', '', $authorization);
//        $creds = explode(':', base64_decode($cut));