fabfuel / prophiler

PHP Profiler & Developer Toolbar (built for Phalcon)
http://prophiler.fabfuel.de
Other
443 stars 54 forks source link

how to trace timeline on phalcon? #34

Closed hardlick closed 9 years ago

hardlick commented 9 years ago

Hi, i cant view nothing on timeline :( i put in my index.php:

include APP_PATH . 'vendor/autoload.php';

$profiler = new \Fabfuel\Prophiler\Profiler();

and the end of file: after: echo $application->handle()->getContent();

i put:

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

too:

$di = new FactoryDefault();
$di->setShared('profiler', $profiler);

i dont know where put:

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

at the end of my index.php too?

Help!, what I'm missing?

fabfuel commented 9 years ago

Hi,

you should register the plugin manager as soon as possible:

$profiler = new \Fabfuel\Prophiler\Profiler();
$di->set('profiler', $profiler, true);

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

It'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'));

Best Fabian

hardlick commented 9 years ago

Hi @fabfuel , thanks for your answers, i changed:

$di->setShared('profiler', $profiler);

for

$di->set('profiler', $profiler, true);

but i dont know where put:

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

Help please

hardlick commented 9 years ago

who is $dispatcher ?, sorry but iam new on phalcon...... :(

hardlick commented 9 years ago

help @fabfuel :(

fabfuel commented 9 years ago

Here you find all the infos about the Phalcon dispatcher: http://docs.phalconphp.com/en/latest/reference/dispatching.html

In you services.php (or what ever place you define your services) do:

$di->set('dispatcher', function() use ($di) {
    $dispatcher = new \Phalcon\Mvc\Dispatcher();
    $dispatcher->setEventsManager($di->get('eventsManager'));
    return $dispatcher;
}, true);
hardlick commented 9 years ago

thanks a lot", this works!