1[![Build Status](https://travis-ci.org/sebastianbergmann/php-timer.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-timer)
2
3# PHP_Timer
4
5Utility class for timing things, factored out of PHPUnit into a stand-alone component.
6
7## Installation
8
9You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
10
11    composer require phpunit/php-timer
12
13If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
14
15    composer require --dev phpunit/php-timer
16
17## Usage
18
19### Basic Timing
20
21```php
22PHP_Timer::start();
23
24// ...
25
26$time = PHP_Timer::stop();
27var_dump($time);
28
29print PHP_Timer::secondsToTimeString($time);
30```
31
32The code above yields the output below:
33
34    double(1.0967254638672E-5)
35    0 ms
36
37### Resource Consumption Since PHP Startup
38
39```php
40print PHP_Timer::resourceUsage();
41```
42
43The code above yields the output below:
44
45    Time: 0 ms, Memory: 0.50MB
46