/** * after event */ public function afterExecuteRoute() { // todo debug mode $toolbar = new \Fabfuel\Prophiler\Toolbar($this->di->get('profiler')); $toolbar->addDataCollector(new \Fabfuel\Prophiler\DataCollector\Request()); //echo $toolbar->render(); //$this->view->disable(); }
<?php error_reporting(-1); error_reporting(E_ALL); ini_set('display_errors', TRUE); try { if (!defined('DIRS')) { define('DIRS', DIRECTORY_SEPARATOR); } if (!defined('ROOTFULLPATH')) { define('ROOTFULLPATH', dirname(__DIR__)); } if (!defined('TRACK')) { define('TRACK', TRUE); } require_once ROOTFULLPATH . '/vendor/autoload.php'; $profiler = new \Fabfuel\Prophiler\Profiler(); $bootstrap = $profiler->start('Bootstrap', ['lorem' => 'ipsum'], 'Application'); require_once 'bootstrap/Load.php'; $di = new \Phalcon\DI\FactoryDefault(); $di->setShared('profiler', $profiler); $Load = new Load($di); $app = $Load->run(); $profiler->stop($bootstrap); echo $app->handle()->getContent(); } catch (\Phalcon\Exception $e) { echo $e->getMessage(); } $toolbar = new \Fabfuel\Prophiler\Toolbar($profiler); $toolbar->addDataCollector(new \Fabfuel\Prophiler\DataCollector\Request()); //echo $toolbar->render();
$profiler->stop($router); $logger->alert('Route could not be found'); $controller = $profiler->start('Controller', ['some' => 'value', 'foobar' => 123, 'array' => ['foo' => 'bar', 'lorem' => true, 'ipsum' => 1.5]], 'Application'); usleep($wait(200)); $view = $profiler->start('View::render', ['data' => ['user' => ['name' => 'John Doe', 'age' => 26]], 'foobar' => 123], 'View'); usleep($wait(10)); $profiler->stop($view); $logger->notice('Undefined variable: $foobar', ['some' => 'context']); $view = $profiler->start('View::render', ['data' => ['user' => ['name' => 'John Doe', 'age' => 26]], 'foobar' => 123], 'View'); usleep($wait(10)); $profiler->stop($view); $logger->critical('Lorem Ipsum', ['some' => 'context']); $database = $profiler->start('\\Fabfuel\\Mongo\\Collection\\Foobar\\LoremIpsum::doSomeFancyFoobarStuff', ['query' => ['user' => 12312], 'foobar' => 123], 'MongoDB'); usleep($wait(200)); $profiler->stop($database); $logger->debug('Analyze query', ['query' => ['user' => 12312], 'foobar' => 123]); $view = $profiler->start('View::render', ['data' => ['user' => ['name' => 'John Doe', 'age' => 26]], 'foobar' => 123], 'View'); usleep($wait(100)); $profiler->stop($view); $profiler->stop($controller); usleep($wait(20)); $logger->error('Foobar not found', ['some' => 'context']); $profiler->stop($dispatcher); $bootstrap = $profiler->start('Session::write', ['lorem' => 'ipsum'], 'Sessions'); usleep($wait(45)); $profiler->stop($bootstrap); $logger->emergency('Done, gimme work!'); $toolbar = new \Fabfuel\Prophiler\Toolbar($profiler); $toolbar->addDataCollector(new \Fabfuel\Prophiler\Demo\DataCollector\Request()); $toolbar->addDataCollector(new \Fabfuel\Prophiler\Demo\DataCollector\User()); echo $toolbar->render();
/** * initialize() Initial all global objects * @access public * @return null */ public function initialize() { /** * @TODO Global Search library */ /**$s = (new \Phalcon\Searcher\Searcher())->setSearchList([ '\Models\Categories' => ['title', 'description', 'alias'], '\Models\Currency' => ['code', 'name'], '\Models\Engines' => ['host', 'name', 'description'], '\Models\Users' => ['login', 'name', 'surname'], ])->useStrict(false)->setQuery('qqqq')->getResult(); */ // load configurations $this->_config = $this->di->get('config'); if ($this->_config->logger->enable) { $this->_logger = $this->di->get('logger'); } // setup breadcrumbs $this->_breadcrumbs = $this->di->get('breadcrumbs'); // setup navigation $navigation = $this->di->get('navigation'); $navigation->setActiveNode($this->router->getActionName(), $this->router->getControllerName(), $this->router->getModuleName()); if (APPLICATION_ENV == 'development') { // add toolbar to the layout $toolbar = new \Fabfuel\Prophiler\Toolbar($this->di->get('profiler')); $toolbar->addDataCollector(new \Fabfuel\Prophiler\DataCollector\Request()); $this->view->setVar('toolbar', $toolbar); } // global view variables $this->view->setVars(['user' => $this->_user, 'breadcrumbs' => $this->_breadcrumbs, 'navigation' => $navigation]); }