PHP code example of sandermuller / stopwatch

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

    

sandermuller / stopwatch example snippets


use SanderMuller\Stopwatch\Stopwatch;

$stopwatch = Stopwatch::start();

use SanderMuller\Stopwatch\Stopwatch;

$stopwatch = Stopwatch::start();

$stopwatch->checkpoint('First checkpoint');
// Or
$stopwatch->lap('Second checkpoint');

use SanderMuller\Stopwatch\Stopwatch;

$stopwatch = Stopwatch::start();

// Do something

echo $stopwatch->toString();
// or
echo (string) $stopwatch;
// Echoes something like: 116ms

use SanderMuller\Stopwatch\Stopwatch;

$stopwatch = Stopwatch::start();

// Do something

$stopwatch->checkpoint('First checkpoint');

// Do something more

$stopwatch->checkpoint('Second checkpoint');

echo $stopwatch->toHtml();
// Or in Laravel
{{ $stopwatch }}

use SanderMuller\Stopwatch\Stopwatch;

$stopwatch = Stopwatch::start();

// Do something

$stopwatch->stop();

// Do something you don't want to measure

// Finally render the output
echo $stopwatch->toHtml();