PHP code example of stevad / yii-xhprof

1. Go to this page and download the library: Download stevad/yii-xhprof 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/ */

    

stevad / yii-xhprof example snippets


return array(
    'preload' => array(
        'xhprof'
    ),
    'components' => array(
        'xhprof' => array(
            'class' => 'ext.yii-xhprof.XHProfComponent', // if you install to protected/extensions
            'libPath' => '/full/path/to/xhprof_lib',
            'htmlReportBaseUrl' => 'http://url.path.to/xhprof_html',
        ),
    ),
);

return array(
    'components' => array(
        'debug' => array(
            // ... other debug config options ...
            'panels' => array(
                'xhprof' => array(
                    'class' => 'ext.yii-xhprof.XHProfPanel' // if you install to protected/extensions
                )
            )
        ),
    ),
);

// create and configure instance of XHProf class
XHProf::getInstance()->configure(array(
    'flagNoBuiltins' => true,
    'flagCpu' => false,
    'flagMemory' => true,
    'runNamespace' => 'my-cool-namespace',
    'libPath' => '/var/www/html/xhprof/xhprof_lib',
    'htmlUrlPath' => 'http://test.local/xhprof/xhprof_html'
));

// start profiler
XHProf::getInstance()->run();

// stop profiler
XHProf::getInstance()->stop();