sandermuller/stopwatch

Lightweight profiler for PHP and Laravel. Add checkpoints, measure closures, track queries and memory, and surface results as HTML, Server-Timing headers, log entries, or Debugbar timelines.
56,845 9
Install
composer require sandermuller/stopwatch
Latest Version:v0.14.0
PHP:^8.3
License:MIT
Last Updated:Sep 17, 2026
Links: GitHub  ·  Packagist
Maintainer: SanderMuller

Stopwatch for PHP & Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads License Laravel Compatibility

A lightweight profiler for PHP and Laravel. Add checkpoints, measure closures, track queries, memory and outbound HTTP, and see where the time goes. Use it when a request, command or job feels slow and an APM is more than you need. It runs in production, in tests and in CI.

PHP 8.3+ · Laravel 12.x / 13.x

Installation

composer require sandermuller/stopwatch
php artisan vendor:publish --tag=stopwatch-config   # optional

Quick start

stopwatch()->withQueryTracking()->start();

$users  = User::all();
stopwatch()->checkpoint('Load users');

$orders = Order::where('status', 'pending')->get();
stopwatch()->checkpoint('Load orders');

stopwatch()->toLog('Profile:');
// Profile:
//   [3ms / 3ms]   Load users  (queries=1)
//   [12ms / 15ms] Load orders (queries=1)
//   Total: 15ms

checkpoint() starts the stopwatch on its own, so start() is only needed to reset an earlier run.

Render it as a self-contained HTML card instead:

@stopwatch

The rendered card

Documentation

Published at https://sandermuller.github.io/Stopwatch/.

The sources are in docs/.

Testing

composer test

Changelog

CHANGELOG lists the recent changes.

Contributing

CONTRIBUTING covers local setup and the pull-request process.

Security vulnerabilities

Report a vulnerability through the security policy rather than a public issue.

Credits

License

The MIT License (MIT). Please see the License File for more information.

Related Packages

hannesvdvreken/guzzle-debugbar

A Guzzle middleware that logs requests to debugbar's timeline

439,900 76
jaydeep/laravel-time-machine

Inspect, profile and visualize every stage of the Laravel request lifecycle — fr...

3,687 70
laracraft-tech/laravel-xhprof

Easy XHProf setup to profile your laravel application!

391,275 235
bavix/laravel-xhprof

Quick profiling of your code for Laravel

158,163 22
ka4ivan/laravel-api-debugger

A debugging tool for Laravel APIs that provides request execution time and query...

1,057 7