shawnlindstrom/laravel-timer

v0.1.4 2018-12-11 19:50 UTC

This package is auto-updated.

Last update: 2024-05-12 08:31:39 UTC


README

Packagist Packagist

This simple package provides high-resolution, monotonic time when available (PHP >=7.3) for all your timing needs.

Installation

Via Composer

$ composer require shawnlindstrom/laravel-timer

Usage

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);

Change log

Please see the changelog for more information on what has changed recently.

Testing

composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email shawn@tenerant.com instead of using the issue tracker.

Credits

  • [Shawn Lindstrom][link-author]
  • [All Contributors][link-contributors]

License

MIT. Please see the license file for more information.