PHP code example of axios / xhprof-composer

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

    

axios / xhprof-composer example snippets



namespace xhprof;


/*** begin ***/

dump('this is example for use xhprof-composer');
$a = pow(2, 10);
dump($a);

/*** end ***/

$report = XHProf::end('test');
dump($report);
$run_id = XHProf::getRunId('test');
dump($run_id);


dump(XHProfRuns::query()->find($run_id));

$list = [
    '38cece5b1ce049e446b5f58fba0aba7c',
    '86cd5712d2a679efe80c743d1d2342e8',
    '773a5a2a3a50ebf16fa0dc5256cafd46'
];

$data = XHProfRuns::query()->select($list);
dump($data);


$report = XHProf::report($run_id);

dump($report->getTotalCpuTime());
dump($report->getTotalMemory());
dump($report->getList());
dump($report->getTree());
shell
service php-fpm restart