PHP code example of link0 / profiler

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

    

link0 / profiler example snippets


    $connectionAddress = 'mongodb://mongodb.example.com:27017';
    $mongoClient = new \Link0\Profiler\PersistenceHandler\MongoDbHandler\MongoClient($connectionAddress);
    $persistenceHandler = new \Link0\Profiler\PersistenceHandler\MongoDbHandler($mongoClient);
    $profiler = new \Link0\Profiler\Profiler($persistenceHandler);
    $profiler->start();

$profiler = new \Link0\Profiler\Profiler();
$profiler->start();
print_r($profiler->stop());

$profiler = new \Link0\Profiler\Profiler();
$profiler->startOn(@$_COOKIE['_profiler']);
// or
$profiler->startOn(@$_COOKIE['XHProf_Profile']);

$persistenceHandler = new \Link0\Profiler\PersistenceHandler\MemoryHandler();
$profiler = new \Link0\Profiler\Profiler($persistenceHandler);

$filesystemAdapter = new \League\Flysystem\Adapter\Local('/tmp/profiler');
$filesystem = new \League\Flysystem\Filesystem($filesystemAdapter);
$persistenceHandler = new \Link0\Profiler\PersistenceHandler\FilesystemHandler($filesystem);
$profiler = new \Link0\Profiler\Profiler($persistenceHandler);