Exemplo n.º 1
0
Arquivo: dev.php Projeto: noikiy/owl
<?php

/**
 * @author Patsura Dmitry http://github.com/ovr <*****@*****.**>
 */
use Owl\Application;
use Owl\Http\Request;
use Owl\Router\Route;
use Owl\Router\Router;
error_reporting(-1);
ini_set('display_errors', 1);
include_once __DIR__ . '/../vendor/autoload.php';
include_once __DIR__ . '/../app/Application.php';
$eventManager = new \Owl\Event\Manager();
$profiler = new Owl\Debug\Profiler();
$profiler->listen($eventManager);
$application = new \RestApp\Application(new Owl\Service\Manager(), $eventManager);
$response = $application->bootstrap()->handle(Request::createFromGlobals(), new \Owl\Http\Response\Json());
$response = $profiler->setContent($response);
$response->send();
Exemplo n.º 2
0
Arquivo: index.php Projeto: noikiy/owl
<?php

/**
 * @author Patsura Dmitry http://github.com/ovr <*****@*****.**>
 */
use Owl\Application;
use Owl\Http\Request;
use Owl\Router\Route;
use Owl\Router\Router;
error_reporting(-1);
ini_set('display_errors', 1);
include_once __DIR__ . '/../vendor/autoload.php';
$eventManager = new \Owl\Event\Manager();
$profiler = new Owl\Debug\Profiler();
$profiler->setAssetsUri('//assets.owl.local/profiler/min.css');
$profiler->listen($eventManager);
$serviceManager = new Owl\Service\Manager();
$router = new Router();
$router->add('/', ['module' => 'Common', 'controller' => 'Index', 'action' => 'index']);
$serviceManager->set('router', $router);
$driver = new \Owl\DBAl\Driver\Mysql('mysql:host=127.0.0.1;dbname=phalcon-module-skeleton;port=49153', 'root', 'root', array(PDO::ATTR_PERSISTENT => true, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "UTF8"'));
$connection = new \Owl\DBAL\Connection(['driver' => $driver], $eventManager);
$serviceManager->set('connection', $connection);
$cache = new \Owl\Cache\Driver\Memcached();
$serviceManager->set('cache', $cache);
$view = new \Owl\Mvc\View();
$view->setPath(__DIR__ . '/../app/modules/common/resources/views/');
$serviceManager->set('view', $view);
$application = new Application($serviceManager, $eventManager);
$application->setErrorHandlerParameters(array('module' => 'Common', 'controller' => 'Index', 'action' => 'error'));
$application->setExceptionHandlerParameters(array('module' => 'Common', 'controller' => 'Index', 'action' => 'exception'));