enricospa / microtime-tracker
A PHP micro library for time tracking
v0.1.1
2021-02-02 09:02 UTC
Requires
- php: >=8.0
- pear/console_table: ^1.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
README
A PHP micro library for time tracking.
About
Have you ever find yourself using PHP microtime
function for timing script execution?
Microtime Tracker
is microtime, with superpowers 💪
Getting Started
To use this library in your project simply require it with Composer.
Installation
Install using Composer
composer require enricospa/microtime-tracker
Usage
Code example:
use Enricospa\MicrotimeTracker\Tracker; use Enricospa\MicrotimeTracker\TimestampHolder; // Init the tracker $tracker = new Tracker(new TimestampHolder); // First snap starts the tracker $tracker->snap('Start tracking'); // Sleep for a while usleep(2000000); $tracker->snap('Slept for a while'); echo "<pre>"; echo $tracker->reportConsole(); echo "</pre>";
More examples coming...
License
See the LICENSE file for license rights and limitations (MIT).