Skip to content

Commit 84bec1d

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Added Stopwatch example to the README Bump Symfony version to 4.4.16 Update VERSION for 4.4.15 Update CHANGELOG for 4.4.15
2 parents a6103ad + 619509e commit 84bec1d

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/Symfony/Component/Stopwatch/README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,39 @@ Stopwatch Component
33

44
The Stopwatch component provides a way to profile code.
55

6+
Getting Started
7+
---------------
8+
9+
```
10+
$ composer require symfony/stopwatch
11+
```
12+
13+
```php
14+
use Symfony\Component\Stopwatch\Stopwatch;
15+
16+
$stopwatch = new Stopwatch();
17+
18+
// optionally group events into sections (e.g. phases of the execution)
19+
$stopwatch->openSection();
20+
21+
// starts event named 'eventName'
22+
$stopwatch->start('eventName');
23+
24+
// ... run your code here
25+
26+
// optionally, start a new "lap" time
27+
$stopwatch->lap('foo');
28+
29+
// ... run your code here
30+
31+
$event = $stopwatch->stop('eventName');
32+
33+
$stopwatch->stopSection('phase_1');
34+
```
35+
636
Resources
737
---------
838

9-
* [Documentation](https://symfony.com/doc/current/components/stopwatch.html)
1039
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
1140
* [Report issues](https://github.com/symfony/symfony/issues) and
1241
[send Pull Requests](https://github.com/symfony/symfony/pulls)

0 commit comments

Comments
 (0)