PHP code example of chocofamilyme / profiler

1. Go to this page and download the library: Download chocofamilyme/profiler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chocofamilyme / profiler example snippets


  
    return [
        'driver' => env('PROFILER_DRIVER', 'pinba'),
    ];

    $di = \Phalcon\Di::getDefault();
    $di->setShared('profiler', function () use ($di) {
      $configProfiler = new Config([
        'hostName'   => 'prod1',
        'serverName' => 'test.com'
      ]);

      return new Chocofamily\Profiler\Pinba($configProfiler);
    });  

$url = $application->router->getMatchedRoute()->getPattern();
$method = $application->request->getMethod();

$application->getDI()->get('profiler')->script($method.': '.$url);

$profiler = \Phalcon\Di::getDefault()->get('profiler');
$timer = $this->profiler->start('DB', '', 'SELECT', 'Oauth permission check');

// Какая-та логика приложения

$profiler->stop($timer);