symfony/stopwatch

Provides a way to profile code

Maintainers

Package info

github.com/symfony/stopwatch

Homepage

pkg:composer/symfony/stopwatch

Statistics

Installs: 402 283 922

Dependents: 978

Suggesters: 65

Stars: 2 825

v8.1.0 2026-05-29 05:06 UTC

This package is auto-updated.

Last update: 2026-05-29 08:53:18 UTC


README

The Stopwatch component provides a way to profile code.

Getting Started

composer require symfony/stopwatch
use Symfony\Component\Stopwatch\Stopwatch;

$stopwatch = new Stopwatch();

// optionally group events into sections (e.g. phases of the execution)
$stopwatch->openSection();

// starts event named 'eventName'
$stopwatch->start('eventName');

// ... run your code here

// optionally, start a new "lap" time
$stopwatch->lap('foo');

// ... run your code here

$event = $stopwatch->stop('eventName');

$stopwatch->stopSection('phase_1');

Sponsor

This package is looking for a backer.

Help Symfony by sponsoring its development!

Resources