Skip to content

Latest commit

 

History

History
72 lines (46 loc) · 1.36 KB

README.md

File metadata and controls

72 lines (46 loc) · 1.36 KB

laravel-timer

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 [email protected] 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.