PHP code example of myaaghubi / debench

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

    

myaaghubi / debench example snippets


namespace DEBENCH;

ur index.php after autoload 
// then check the webpage with your browser
// $debench = new Debench(true, '../public', $base->get('ASSETS'));
Debench::getInstance(true, '../public', $base->get('ASSETS'));

// for enable() or minimalOnly() you can 
// call them even before getInstance
Debench::enable(false);

// for dump(), info(), warning() and error() you can 
// call them before getInstance too
Debench::info('let\'s use some memory');

// let's load some
$st = str_repeat("Debench!", 10000);
Debench::point('one');
Debench::dump($st);

// let's load some more
$st .= str_repeat("Debench!", 10000);
// $debench->newPoint("two");
Debench::point('two');

// it is safe and secure to use
// $debench->setMinimalOnly(true);
Debench::minimalOnly(true);

// it's better to do it on initializing
//$debench = new Debench(false);
Debench::getInstance(false);
// or
Debench::enable(false);

// Debench::compare($func1, $func2, $tag='', $iterations=1000);
Debench::compare(function () use ($mongo) {
    $mongo->find([])
}, function () use ($sql) {
    $sql->exec('select ...');
});