PHP code example of shawnlindstrom / laravel-timer
1. Go to this page and download the library: Download shawnlindstrom/laravel-timer 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/ */
shawnlindstrom / laravel-timer example snippets
use shawnlindstrom\LaravelTimer\Timer;
use shawnlindstrom\LaravelTimer\TimeUnit;
$timer = new Timer;
$timer->start();
// Your code to benchmark
sleep(2);
$timer->stop();
echo $timer->elapsed(); // Returns: 2 (default is seconds)
$timer = new Timer;
$timer->start();
// Your code here...
$timer->stop();
// Get elapsed time in different units
$seconds = $timer->elapsed(TimeUnit::SECOND); // 2
$microseconds = $timer->elapsed(TimeUnit::MICROSECOND); // 2000
$milliseconds = $timer->elapsed(TimeUnit::MILLISECOND); // 2000000
$nanoseconds = $timer->elapsed(TimeUnit::NANOSECOND); // 2000000000
use shawnlindstrom\LaravelTimer\TimerFacade as Timer;
use shawnlindstrom\LaravelTimer\TimeUnit;
Timer::start();
// Your code to benchmark...
Timer::stop();
echo Timer::elapsed(TimeUnit::MICROSECOND);
use Timer;
use shawnlindstrom\LaravelTimer\TimeUnit;
Timer::start();
// Your code...
Timer::stop();
echo Timer::elapsed(TimeUnit::MILLISECOND);
$timer = new Timer;
// First measurement
$timer->start();
performTask1();
$timer->stop();
$time1 = $timer->elapsed();
// Second measurement
$timer->start();
performTask2();
$timer->stop();
$time2 = $timer->elapsed();
bash
composer analyse
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.