Skip to content

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

License

Notifications You must be signed in to change notification settings

shawnlindstrom/laravel-timer

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages