1. Go to this page and download the library: Download petrknap/php-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/ */
petrknap / php-profiler example snippets
namespace PetrKnap\Profiler;
$profiling = Profiling::start();
// do something
$profile = $profiling->finish();
printf('It took %.1f s to do something.', $profile->getDuration());
namespace PetrKnap\Profiler;
function doSomething(ProfilerInterface $profiler): string {
return $profiler->profile(function (): string {
return 'something';
})->process(fn (ProfileInterface $profile) => printf(
'It took %.1f s to do something.',
$profile->getDuration(),
));
}