PHP code example of shamanzpua / profiler

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

    

shamanzpua / profiler example snippets



shamanzpua\Profiler\Profiler;
use shamanzpua\Profiler\LogStorages\FileStorage;

$logsPath = "/data/project/logs/profiler/";

Profiler::getInstance()->setLogStorage(new FileStorage($logsPath);

/**
* Set 2 seconds logs threshold
 */
Profiler::getInstance()->setLogDurationThreshold(2000);

performance_profiling_start("PROFILER_LOG_NAME");
profiler_breakpoint("POINT1");
profiler_breakpoint("POINT2");
performance_profiling_stop('POINT3');