1. Go to this page and download the library: Download kehikko/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/ */
kehikko / profiler example snippets
/* optional profiler.php include, done automatically when using composer autoloader */
//al, default shown here
*/
profiler_start('/tmp/kehikko-php-profiler');
profiler_stop();
if (profiler_running() && environment_is_in_production()) {
error_log('running profiler in production environment, stop now!');
die;
}
ow errors in browser, easier this way, this is not production stuff anyways */
error_reporting(E_ALL);
ini_set('display_errors', 1);
/* this should be given to later functions so that they are able to generate links correctly */
$root_url = '/_profiler/';
/* parse profiler "route" url */
$request_url = trim(substr($_SERVER['REQUEST_URI'], strlen($root_url)), '/');
/* path where profiling data is saved (same as given to profiler_start()), following is default */
$datapath = '/tmp/kehikko-php-profiler';
/* limit shown profiling entries to this number, default is 20 */
$limit = 20;
/* "route" */
if ($request_url == '') {
/* to index */
profiler_html_index($root_url, $datapath, $limit);
} else {
/* to single call profile */
$parts = explode('/', $request_url);
$id = array_pop($parts);
if (strpos($request_url, 'graph/') === 0) {
/* generate svg call graph */
profiler_svg_graph_generate($id, $datapath);
} else if (strpos($request_url, 'callgraph/') === 0) {
/* view call graph */
profiler_html_profile_call_graph($id, $root_url, $datapath);
} else {
/* view call profile */
profiler_html_profile($id, $root_url, $datapath);
}
}
sh
apt install php-tideways graphviz
phpenmod tideways
sh
git clone https://github.com/kehikko/profiler.git
cd profiler
composer install
php example/example.php
php -S localhost:8080 web/index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^_profiler(/.*)?$ profiler.php [NC,L,NE]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.