PHP code example of ohansyah / laravelbenchmark

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

    

ohansyah / laravelbenchmark example snippets



 
use App\Models\User;
use Ohansyah\LaravelBenchmark\Benchmark;
 
Benchmark::dd(
    function () { range(1, 1000000); }
);
// 11.415ms


Benchmark::dd([
    function () { range(1, 1000000); },
    function () { User::count(); }
]);

/*
array:2 [
    0 => "10.259ms"
    1 => "111.418ms"
]
*/

Benchmark::dd(
    function () { range(1, 1000000); }, 5
);
// 10.041ms