Skip to content
Snippets Groups Projects
Commit 619509e3 authored by Fabien Potencier's avatar Fabien Potencier
Browse files

minor #38409 [Stopwatch] Added example to the README (wouterj)

This PR was merged into the 4.4 branch.

Discussion
----------

[Stopwatch] Added example to the README

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/14333

Commits
-------

e2461c90 Added Stopwatch example to the README
parents 8cb3387c e2461c90
Branches
Tags
No related merge requests found
......@@ -3,10 +3,39 @@ Stopwatch Component
The Stopwatch component provides a way to profile code.
Getting Started
---------------
```
$ composer require symfony/stopwatch
```
```php
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');
```
Resources
---------
* [Documentation](https://symfony.com/doc/current/components/stopwatch.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment