This simple package provides high-resolution, monotonic time when available (PHP >=7.3) for all your timing needs.
Via Composer
$ composer require shawnlindstrom/laravel-timer
New up an instance:
$timer = new \shawnlindstrom\Timer;
$timer->start();
// do something useful ...
$timer->stop();
echo $timer->elapsed(); // default precision is seconds
// 2
Elapsed time can be returned in seconds, microseconds, milliseconds, or nanoseconds:
$timer->elapsed(TimeUnit::NANOSECONDS);
Via Facade:
Timer::start();
// do something useful ...
Timer::stop();
echo Timer::elapsed(TimeUnit::MICROSECONDS);
Please see the changelog for more information on what has changed recently.
composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
- [Shawn Lindstrom][link-author]
- [All Contributors][link-contributors]
MIT. Please see the license file for more information.