Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

anyone has implement prophiler ??, i cant see nothing on timeline button

Hi, has anyone use prophiler: https://github.com/fabfuel/prophiler

i can not make it work timeline button!...

Any Help? in my index , i have on top:

require dirname(__DIR__) . '/vendor/autoload.php';
$profiler = new \Fabfuel\Prophiler\Profiler();

and the end of the file:

$pluginManager = new \Fabfuel\Prophiler\Plugin\Manager\Phalcon($profiler);
$e =$pluginManager->register();

echo $application->handle()->getContent();

$toolbar = new \Fabfuel\Prophiler\Toolbar($profiler);
$toolbar->addDataCollector(new \Fabfuel\Prophiler\DataCollector\Request());
echo $toolbar->render();

Help please!

i quoute:

t's also important to inject the EventsManager manually to your dispatcher, view and db services, as they don't report to the events manager by default. When you set up e.g. your dispatcher service, please do:

$dispatcher->setEventsManager($di->get('eventsManager'));

Anyone know where put this code?



9.6k
Accepted
answer

for everyone that want see profiler in action:

if your project is multi module:

in your module.php

    <?php

namespace Backend;

use Phalcon\Mvc\Dispatcher,
    Phalcon\Mvc\View,
    Phalcon\Mvc\ModuleDefinitionInterface,
    Phalcon\Events\Manager as EventsManager;

class Module implements ModuleDefinitionInterface {

    /**
     * Register a specific autoloader for the module
     */
    public function registerAutoloaders(\Phalcon\DiInterface $di = null) {

    }

    /**
     * Register specific services for the module
     */
    public function registerServices(\Phalcon\DiInterface $di) {
        //Registering a dispatcher
        $di->set('dispatcher', function () use ($di) {
            $dispatcher = new Dispatcher();
            $dispatcher->setDefaultNamespace("Backend\Controllers");
            $eventsManager = new EventsManager; // log for profiler
            $eventsManager->attach('dispatch:beforeDispatch', new \Common\Helpers\SecurityHelper());  // log for profiler
            $dispatcher->setEventsManager($eventsManager); // log for profiler
            return $dispatcher;
        });

        //Registering the view component
        $di->set('view', function() {
            $view = new View();
            $view->setViewsDir(APP_PATH . 'app/backend/views/');
            $view->setMainView('private');
            $view->registerEngines(array('.volt' => 'voltService'));
            return $view;
        });
    }

}