diff --git a/frameworks/PHP/phalcon/app/collections/FortunesCollection.php b/frameworks/PHP/phalcon/app/collections/FortunesCollection.php new file mode 100644 index 00000000000..f6e1a4c3907 --- /dev/null +++ b/frameworks/PHP/phalcon/app/collections/FortunesCollection.php @@ -0,0 +1,14 @@ +setSource('fortune'); + $this->useImplicitObjectIds(false); + } +} diff --git a/frameworks/PHP/phalcon/app/collections/WorldsCollection.php b/frameworks/PHP/phalcon/app/collections/WorldsCollection.php new file mode 100644 index 00000000000..596217978cc --- /dev/null +++ b/frameworks/PHP/phalcon/app/collections/WorldsCollection.php @@ -0,0 +1,14 @@ +setSource('world'); + $this->useImplicitObjectIds(false); + } +} diff --git a/frameworks/PHP/phalcon/app/config/config.php b/frameworks/PHP/phalcon/app/config/config.php index e164b019b5b..3be4b897b6e 100644 --- a/frameworks/PHP/phalcon/app/config/config.php +++ b/frameworks/PHP/phalcon/app/config/config.php @@ -1,22 +1,25 @@ array( +use Phalcon\Config; + +return new Config([ + 'database' => [ 'adapter' => 'Mysql', 'host' => 'tfb-database', 'username' => 'benchmarkdbuser', 'password' => 'benchmarkdbpass', 'name' => 'hello_world', 'persistent' => true, - ), - 'mongodb' => array( + ], + 'mongodb' => [ 'url' => 'mongodb://tfb-database:27017', 'db' => 'hello_world' - ), - 'application' => array( + ], + 'application' => [ 'controllersDir' => APP_PATH . '/app/controllers/', 'modelsDir' => APP_PATH . '/app/models/', + 'collectionsDir' => APP_PATH . '/app/collections/', 'viewsDir' => APP_PATH . '/app/views/', 'baseUri' => '/', - ) -)); \ No newline at end of file + ] +]); diff --git a/frameworks/PHP/phalcon/app/config/routes.php b/frameworks/PHP/phalcon/app/config/routes.php index f39978ff728..61ce131e8b5 100644 --- a/frameworks/PHP/phalcon/app/config/routes.php +++ b/frameworks/PHP/phalcon/app/config/routes.php @@ -1,50 +1,52 @@ add('/json', array( +$router = new Router(false); + +$router->addGet('/json', [ 'controller' => 'bench', 'action' => 'json', -)); +]); -$router->add('/db', array( +$router->addGet('/db', [ 'controller' => 'bench', 'action' => 'db', -)); +]); -$router->add('/queries', array( +$router->addGet('/queries', [ 'controller' => 'bench', 'action' => 'queries', -)); +]); -$router->add('/fortunes', array( +$router->addGet('/fortunes', [ 'controller' => 'bench', 'action' => 'fortunes', -)); +]); -$router->add('/update', array( +$router->addGet('/update', [ 'controller' => 'bench', 'action' => 'update', -)); +]); -$router->add('/plaintext', array( +$router->addGet('/plaintext', [ 'controller' => 'bench', 'action' => 'plaintext', -)); +]); -$router->add('/mongodb/db', array( - 'controller' => 'mongobench', +$router->addGet('/mongodb/db', [ + 'controller' => 'mongo', 'action' => 'db', -)); +]); -$router->add('/mongodb/queries', array( - 'controller' => 'mongobench', +$router->addGet('/mongodb/queries', [ + 'controller' => 'mongo', 'action' => 'queries', -)); +]); -$router->add('/mongodb/fortunes', array( - 'controller' => 'mongobench', +$router->addGet('/mongodb/fortunes', [ + 'controller' => 'mongo', 'action' => 'fortunes', -)); +]); return $router; diff --git a/frameworks/PHP/phalcon/app/controllers/BenchController.php b/frameworks/PHP/phalcon/app/controllers/BenchController.php index 51e343f2b65..4a0230bbbd8 100644 --- a/frameworks/PHP/phalcon/app/controllers/BenchController.php +++ b/frameworks/PHP/phalcon/app/controllers/BenchController.php @@ -1,35 +1,34 @@ view->setRenderLevel(View::LEVEL_LAYOUT); } - public function jsonAction() + public function jsonAction(): ResponseInterface { - return $this->response->setJsonContent(array( + return $this->response->setJsonContent([ 'message' => 'Hello, World!' - )); + ]); } - public function dbAction() + public function dbAction(): ResponseInterface { return $this->response->setJsonContent($this->getRandomWorld()); } - public function queriesAction() + public function queriesAction(): ResponseInterface { - - $queries = min(500, max(1, $this->filter->sanitize($this->request->getQuery('queries', null, 1), "int"))); - - $worlds = array(); + $queries = min(500, max(1, $this->request->getQuery('queries', "int", 1))); + $worlds = []; for ($i = 0; $i < $queries; ++$i) { $worlds[] = $this->getRandomWorld(); @@ -38,9 +37,8 @@ public function queriesAction() return $this->response->setJsonContent($worlds); } - public function fortunesAction() + public function fortunesAction(): void { - $fortunes = $this->getFortunesArray(); $fortunes[] = $this->buildFortune(); @@ -49,13 +47,12 @@ public function fortunesAction() $this->view->fortunes = $this->sortFortunes($fortunes); } - public function updateAction() + public function updateAction(): ResponseInterface { - - $queries = $this->request->getQuery('queries', null, 1); + $queries = $this->request->getQuery('queries', "int", 1); $queries = max(1, min(500, $queries)); - $worlds = array(); + $worlds = []; for ($i = 0; $i < $queries; ++$i) { $world = $this->getRandomWorld(); @@ -67,11 +64,12 @@ public function updateAction() return $this->response->setJsonContent($worlds); } - public function plaintextAction() + public function plaintextAction(): ResponseInterface { $this->view->disable(); $this->response->setContentType('text/plain'); $this->response->setContent("Hello, World!"); + return $this->response; } @@ -80,7 +78,7 @@ protected function getRandomWorld() return Worlds::findFirst(mt_rand(1, 10000)); } - protected function getFortunesArray() + protected function getFortunesArray(): array { // since the resultset is immutable get an array instead // so we can add the new fortune @@ -89,18 +87,18 @@ protected function getFortunesArray() protected function buildFortune() { - return array( + return [ 'id' => 0, 'message' => 'Additional fortune added at request time.' - ); + ]; } - protected function sortFortunes($fortunes) + protected function sortFortunes(array $fortunes): array { - usort($fortunes, - function($left, $right) { - return $left['message'] <=> $right['message']; - }); + usort($fortunes, function ($left, $right) { + return $left['message'] <=> $right['message']; + }); + return $fortunes; } } diff --git a/frameworks/PHP/phalcon/app/controllers/IndexController.php b/frameworks/PHP/phalcon/app/controllers/IndexController.php index 20897089702..4a2633030f7 100644 --- a/frameworks/PHP/phalcon/app/controllers/IndexController.php +++ b/frameworks/PHP/phalcon/app/controllers/IndexController.php @@ -1,8 +1,10 @@ Wrong controller for this benchmark!"; } diff --git a/frameworks/PHP/phalcon/app/controllers/MongoController.php b/frameworks/PHP/phalcon/app/controllers/MongoController.php new file mode 100644 index 00000000000..c45be0f6da3 --- /dev/null +++ b/frameworks/PHP/phalcon/app/controllers/MongoController.php @@ -0,0 +1,43 @@ + [ + '_id' => mt_rand(1, 10000), + ], + 'projection' => [ + //'id' => 0, + ], + ]); + } + + protected function getFortunesArray(): array + { + return FortunesCollection::find()->toArray(); + } + + protected function buildFortune() + { + $fortune = parent::buildFortune(); + $newFortune = new FortunesCollection(); + $newFortune->setId($fortune['id']); + $newFortune->message = $fortune['message']; + + return $newFortune; + } + + protected function sortFortunes(array $fortunes): array + { + usort($fortunes, function ($left, $right) { + return $left->message <=> $right->message; + }); + + return $fortunes; + } +} diff --git a/frameworks/PHP/phalcon/app/controllers/MongobenchController.php b/frameworks/PHP/phalcon/app/controllers/MongobenchController.php deleted file mode 100644 index 0ef9e593935..00000000000 --- a/frameworks/PHP/phalcon/app/controllers/MongobenchController.php +++ /dev/null @@ -1,37 +0,0 @@ - mt_rand(1, 10000)))); - } - - protected function getFortunesArray() - { - return MongoFortunesCollection::find(); - } - - protected function buildFortune() - { - $fortune = parent::buildFortune(); - $newFortune = new MongoFortunesCollection(); - $newFortune->_id = $fortune['id']; - $newFortune->message = $fortune['message']; - return $newFortune; - } - - protected function sortFortunes($fortunes) - { - usort($fortunes, - function($left, $right) { - return $left->message <=> $right->message; - }); - return $fortunes; - } - -} diff --git a/frameworks/PHP/phalcon/app/models/Fortunes.php b/frameworks/PHP/phalcon/app/models/Fortunes.php index 1e0b3ae2d1e..9df700fb50c 100644 --- a/frameworks/PHP/phalcon/app/models/Fortunes.php +++ b/frameworks/PHP/phalcon/app/models/Fortunes.php @@ -1,9 +1,10 @@ setSource('Fortune'); } - public function metaData() + public function metaData(): array { return [ // Every column in the mapped table @@ -73,4 +74,4 @@ public function metaData() MetaData::MODELS_EMPTY_STRING_VALUES => [], ]; } -} \ No newline at end of file +} diff --git a/frameworks/PHP/phalcon/app/models/FortunesCollection.php b/frameworks/PHP/phalcon/app/models/FortunesCollection.php deleted file mode 100644 index 65772814b31..00000000000 --- a/frameworks/PHP/phalcon/app/models/FortunesCollection.php +++ /dev/null @@ -1,14 +0,0 @@ -setSource('World'); } - public function metaData() + public function metaData(): array { return [ // Every column in the mapped table diff --git a/frameworks/PHP/phalcon/app/models/WorldsCollection.php b/frameworks/PHP/phalcon/app/models/WorldsCollection.php deleted file mode 100644 index 06634e93f22..00000000000 --- a/frameworks/PHP/phalcon/app/models/WorldsCollection.php +++ /dev/null @@ -1,14 +0,0 @@ -idmessage{% for fortune in fortunes %}{{ fortune.getId() }}{{ fortune.message | e }}{% endfor %} \ No newline at end of file diff --git a/frameworks/PHP/phalcon/app/views/mongobench/fortunes.volt b/frameworks/PHP/phalcon/app/views/mongobench/fortunes.volt deleted file mode 100644 index 25fda3f84a4..00000000000 --- a/frameworks/PHP/phalcon/app/views/mongobench/fortunes.volt +++ /dev/null @@ -1 +0,0 @@ -{% for fortune in fortunes %}{% endfor %}
idmessage
{{ fortune._id }}{{ fortune.message | e }}
\ No newline at end of file diff --git a/frameworks/PHP/phalcon/benchmark_config.json b/frameworks/PHP/phalcon/benchmark_config.json index 69eab49bc13..aac4363fd23 100644 --- a/frameworks/PHP/phalcon/benchmark_config.json +++ b/frameworks/PHP/phalcon/benchmark_config.json @@ -40,12 +40,12 @@ "webserver": "nginx", "os": "Linux", "database_os": "Linux", - "display_name": "phalcon-mogodb", + "display_name": "phalcon-mongodb", "notes": "", - "versus": "php", - "tags": ["broken"] + "versus": "php" }, "micro": { + "plaintext_url": "/plaintext", "json_url": "/json", "db_url": "/db", "query_url": "/queries?queries=", diff --git a/frameworks/PHP/phalcon/composer.json b/frameworks/PHP/phalcon/composer.json index 7d20106af6a..f42463f3153 100644 --- a/frameworks/PHP/phalcon/composer.json +++ b/frameworks/PHP/phalcon/composer.json @@ -1,6 +1,6 @@ { - "require": { - "mongodb/mongodb" : "1.0.2", - "phalcon/incubator": "^3.4" - } + "require": { + "mongodb/mongodb": "^1.6", + "phalcon/incubator-mongodb": "^1.0" + } } diff --git a/frameworks/PHP/phalcon/config.toml b/frameworks/PHP/phalcon/config.toml index cfc0d7eeae7..8cce9a40b55 100644 --- a/frameworks/PHP/phalcon/config.toml +++ b/frameworks/PHP/phalcon/config.toml @@ -33,6 +33,7 @@ webserver = "nginx" versus = "php" [micro] +urls.plaintext = "/plaintext" urls.json = "/json" urls.db = "/db" urls.query = "/queries?queries=" diff --git a/frameworks/PHP/phalcon/phalcon-micro.dockerfile b/frameworks/PHP/phalcon/phalcon-micro.dockerfile index 12a04327014..ed758040c03 100644 --- a/frameworks/PHP/phalcon/phalcon-micro.dockerfile +++ b/frameworks/PHP/phalcon/phalcon-micro.dockerfile @@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ - apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql php7.4-phalcon > /dev/null + apt-get install -yqq nginx git unzip \ + php7.4-cli php7.4-fpm php7.4-mysql php7.4-mbstring > /dev/null RUN apt-get install -yqq composer > /dev/null @@ -14,7 +15,7 @@ COPY deploy/conf/* /etc/php/7.4/fpm/ ADD ./ /phalcon WORKDIR /phalcon -#RUN apt-get install -yqq php7.4-phalcon > /dev/null +RUN apt-get install -yqq php7.4-psr php7.4-phalcon > /dev/null RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi; diff --git a/frameworks/PHP/phalcon/phalcon-mongodb.dockerfile b/frameworks/PHP/phalcon/phalcon-mongodb.dockerfile index 7105382211d..8a75d9633f5 100644 --- a/frameworks/PHP/phalcon/phalcon-mongodb.dockerfile +++ b/frameworks/PHP/phalcon/phalcon-mongodb.dockerfile @@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ - apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql php7.4-mongodb > /dev/null + apt-get install -yqq nginx git unzip \ + php7.4-cli php7.4-fpm php7.4-mysql php7.4-mbstring php7.4-mongodb > /dev/null RUN apt-get install -yqq composer > /dev/null @@ -16,7 +17,7 @@ WORKDIR /phalcon RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi; -RUN apt-get install -yqq php7.4-phalcon > /dev/null +RUN apt-get install -yqq php7.4-psr php7.4-phalcon > /dev/null RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet --ignore-platform-reqs diff --git a/frameworks/PHP/phalcon/phalcon.dockerfile b/frameworks/PHP/phalcon/phalcon.dockerfile index 7c77691041d..0d844a0f4fc 100644 --- a/frameworks/PHP/phalcon/phalcon.dockerfile +++ b/frameworks/PHP/phalcon/phalcon.dockerfile @@ -6,7 +6,7 @@ RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /de RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ apt-get install -yqq nginx git unzip \ - php7.4-cli php7.4-fpm php7.4-mysql php7.4-mongodb php7.4-mbstring > /dev/null + php7.4-cli php7.4-fpm php7.4-mysql php7.4-mbstring > /dev/null RUN apt-get install -yqq composer > /dev/null @@ -15,7 +15,7 @@ COPY deploy/conf/* /etc/php/7.4/fpm/ ADD ./ /phalcon WORKDIR /phalcon -RUN apt-get install -yqq php7.4-phalcon > /dev/null +RUN apt-get install -yqq php7.4-psr php7.4-phalcon > /dev/null RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi; diff --git a/frameworks/PHP/phalcon/public/index-micro.php b/frameworks/PHP/phalcon/public/index-micro.php index 0278c964096..a423868bed5 100644 --- a/frameworks/PHP/phalcon/public/index-micro.php +++ b/frameworks/PHP/phalcon/public/index-micro.php @@ -1,114 +1,106 @@ 'tfb-database', - 'dbname' => 'hello_world', - 'username' => 'benchmarkdbuser', - 'password' => 'benchmarkdbpass', - 'options' => [ - PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'", - PDO::ATTR_PERSISTENT => TRUE, - ] - )); + $app['db'] = function () { + return new Mysql([ + 'host' => 'tfb-database', + 'dbname' => 'hello_world', + 'username' => 'benchmarkdbuser', + 'password' => 'benchmarkdbpass', + 'options' => [ + PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'", + PDO::ATTR_PERSISTENT => true, + ], + ]); }; // Setting up the view component (seems to be required even when not used) - $app['view'] = function() { - - $view = new \Phalcon\Mvc\View(); - + $app['view'] = function () { + $view = new View(); $view->setViewsDir(__DIR__ . '/../app/views/'); - - $view->registerEngines(array( - ".volt" => function($view) { - - $volt = new \Phalcon\Mvc\View\Engine\Volt($view); - - $volt->setOptions(array( + $view->registerEngines([ + ".volt" => function ($view) { + $volt = new Volt($view); + $volt->setOptions([ "path" => __DIR__ . "/../app/compiled-templates/", "extension" => ".c", "separator" => '_', - )); + ]); return $volt; } - )); + ]); return $view; }; - - $app->map('/plaintext', function() { + + /** + * Routes + */ + $app->map('/plaintext', function () { header("Content-Type: text/plain; charset=UTF-8"); - echo "Hello, World!"; + echo "Hello, World!"; }); - $app->map('/json', function() { + $app->map('/json', function () { header("Content-Type: application/json"); - echo json_encode(array('message' => 'Hello, World!')); + echo json_encode(['message' => 'Hello, World!']); }); - // - $app->map('/db', function() use ($app) { - header("Content-Type: application/json"); - + $app->map('/db', function () use ($app) { $db = $app['db']; - - $world = $db->fetchOne('SELECT * FROM world WHERE id = ' . mt_rand(1, 10000), Phalcon\Db\Enum::FETCH_ASSOC); + $world = $db->fetchOne('SELECT * FROM world WHERE id = ' . mt_rand(1, 10000), Enum::FETCH_ASSOC); + header("Content-Type: application/json"); echo json_encode($world); }); - - // queries - $app->map('/queries', function() use ($app) { - header("Content-Type: application/json"); - + $app->map('/queries', function () use ($app) { $db = $app['db']; - $queries = $app->request->getQuery('queries', null, 1); - $queries = is_numeric($queries) ? min(max(intval($queries), 1), 500) : 1; + $queries = $app->request->getQuery('queries', "int", 1); + $queries = min(max(intval($queries), 1), 500); - $worlds = array(); + $worlds = []; for ($i = 0; $i < $queries; ++$i) { - $worlds[] = $db->fetchOne('SELECT * FROM world WHERE id = ' . mt_rand(1, 10000), Phalcon\Db\Enum::FETCH_ASSOC); + $worlds[] = $db->fetchOne('SELECT * FROM world WHERE id = ' . mt_rand(1, 10000), Enum::FETCH_ASSOC); } + header("Content-Type: application/json"); echo json_encode($worlds); }); - // /fortunes - $app->map('/fortunes', function() use ($app) { - + $app->map('/fortunes', function () use ($app) { $fortunes = $app['db']->query('SELECT * FROM fortune')->fetchAll(); - - $fortunes[] = array( + $fortunes[] = [ 'id' => 0, 'message' => 'Additional fortune added at request time.' - ); + ]; - usort($fortunes, function($left, $right) { + usort($fortunes, function ($left, $right) { return $left['message'] <=> $right['message']; }); header("Content-Type: text/html; charset=utf-8"); - echo $app['view']->getRender('bench', 'fortunes', array( - 'fortunes' => $fortunes - )); - + echo $app['view']->getRender('bench', 'fortunes', [ + 'fortunes' => $fortunes, + ]); }); - + $url = $_REQUEST['_url'] ?? '/'; $app->handle($url); - -} catch(\Phalcon\Exception $e) { +} catch (PhalconException $e) { echo "PhalconException: ", $e->getMessage(); } diff --git a/frameworks/PHP/phalcon/public/index.php b/frameworks/PHP/phalcon/public/index.php index c473131b19c..f9a4781d889 100644 --- a/frameworks/PHP/phalcon/public/index.php +++ b/frameworks/PHP/phalcon/public/index.php @@ -1,102 +1,104 @@ registerDirs(array( + $loader = new Loader(); + $loader->registerDirs([ $config->application->controllersDir, - $config->application->modelsDir - ))->register(); + $config->application->modelsDir, + $config->application->collectionsDir, + ])->register(); // Create a DI - $di = new Phalcon\DI\FactoryDefault(); + $di = new FactoryDefault(); // Setting up the router - $di->set('router', require APP_PATH . '/app/config/routes.php'); + $di->setShared('router', require APP_PATH . '/app/config/routes.php'); //MetaData - $di->set('modelsMetadata', function(){ + $di->setShared('modelsMetadata', function () { if (function_exists('apc_store')) { - return new Phalcon\Mvc\Model\MetaData\Apc(); - } else { - return new Phalcon\Mvc\Model\MetaData\Memory(array( - 'metaDataDir' => APP_PATH . "/app/compiled-templates/" - )); + return new Apc(); } + + return new Memory([ + 'metaDataDir' => APP_PATH . "/app/compiled-templates/" + ]); }); // Setting up the view component (seems to be required even when not used) - $di->set('view', function() use ($config) { - - $view = new \Phalcon\Mvc\View(); - + $di->setShared('view', function () use ($config) { + $view = new View(); $view->setViewsDir($config->application->viewsDir); - - $view->registerEngines(array( - ".volt" => function($view) { - - $volt = new \Phalcon\Mvc\View\Engine\Volt($view); - - $volt->setOptions(array( + $view->registerEngines([ + ".volt" => function ($view) { + $volt = new Volt($view); + $volt->setOptions([ "path" => APP_PATH . "/app/compiled-templates/", "extension" => ".compiled", "separator" => '_', - )); + ]); return $volt; } - )); + ]); return $view; }); // Setting up the database connection - $di->set('db', function() use ($config) { - + $di->setShared('db', function () use ($config) { $database = $config->database; - return new \Phalcon\Db\Adapter\Pdo\Mysql(array( + return new Mysql([ 'host' => $database->host, 'username' => $database->username, 'password' => $database->password, 'dbname' => $database->name, - 'options' => array( + 'options' => [ PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::ATTR_PERSISTENT => true, - ) - )); + ], + ]); }); // Setting up the mongodb connection - $di->set('mongo', function() use ($config) { + $di->setShared('mongo', function () use ($config) { $mongodbConfig = $config->mongodb; + $mongo = new Client($mongodbConfig->url); - $mongo = new \Phalcon\Db\Adapter\MongoDB\Client($mongodbConfig->url); return $mongo->selectDatabase($mongodbConfig->db); }); - //Registering the collectionManager service - $di->set('collectionManager', function() { - // Setting a default EventsManager - $modelsManager = new Phalcon\Mvc\Collection\Manager(); - $modelsManager->setEventsManager(new Phalcon\Events\Manager()); - return $modelsManager; - - }, true); + // Registering the mongoDB CollectionManager service + $di->setShared('collectionsManager', function () { + return new MongoDBCollectionManager(); + }); // Handle the request - $request = new Phalcon\Http\Request(); - $application = new \Phalcon\Mvc\Application(); + $request = new Request(); + $application = new Application(); $application->setDI($di); $application->handle($request->getURI())->send(); - -} catch(\Phalcon\Exception $e) { +} catch (PhalconException $e) { echo "PhalconException: ", $e->getMessage(); }