3
Utility class for timing things, factored out of PHPUnit into a stand-alone component.
7
You can use the [PEAR Installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php) or [Composer](http://getcomposer.org/) to download and install this package as well as its dependencies.
11
The following two commands (which you may have to run as `root`) are all that is required to install this package using the PEAR Installer:
13
pear config-set auto_discover 1
14
pear install pear.phpunit.de/PHP_Timer
18
To add this package as a local, per-project dependency to your project, simply add a dependency on `phpunit/php-timer` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on PHP_Timer:
22
"phpunit/php-timer": "*"
37
$time = PHP_Timer::stop();
40
print PHP_Timer::secondsToTimeString($time);
43
The code above yields the output below:
45
double(1.0967254638672E-5)
48
#### Resource Consumption Since PHP Startup
51
print PHP_Timer::resourceUsage();
54
The code above yields the output below:
56
Time: 0 ms, Memory: 0.50Mb