Easily profile of parts of your application/code and measure the performance to expose the bottlenecks
You can install the package via composer:
composer require sandermuller/stopwatchstopwatch()->start();stopwatch()->start();
stopwatch()->checkpoint('First checkpoint');
// Or
stopwatch()->lap('Second checkpoint');stopwatch()->start();
stopwatch()->log('Second checkpoint');stopwatch()->start();
// Do something
echo stopwatch()->toString();
// Echoes something like: 116msRender a neat HTML output showing the total execution time, each checkpoint and the time between each checkpoint.
The checkpoints that took up most of the time will be highlighted.
stopwatch()->start();
// Do something
stopwatch()->checkpoint('First checkpoint');
// Do something more
stopwatch()->checkpoint('Second checkpoint');
// Render the output
{{ stopwatch()->render() }}You can manually stop the stopwatch, but it will also stop automatically when the Stopwatch output is used (e.g. when you echo the Stopwatch object or call ->totalRunDuration()).
stopwatch()->start();
// Do something
stopwatch()->checkpoint('First checkpoint');
// Stop the stopwatch
stopwatch()->stop();
// Do something else you don't want to measure
// Finally render the output
{{ stopwatch()->render() }}