Available versions:


composer require aeon-php/sleep


This library provides literally one function that makes it easier to pause your process for a certain time.

Let say you would like to sleep for 200 milliseconds. Instead of using usleep and multiplication of 200 by... exactly, how much? Just use Aeon sleep.


use Aeon\Calendar\TimeUnit;
use function \Aeon\Sleep\sleep;


Thanks to TimeUnit you can sleep with any precision you need.

Sleeping in tests might be tricky, one might put sleep in the test case but who likes slow test suite? Instead of using function go with SystemProcess and expect instance of Process in your system under test.


use Aeon\Calendar\System\SystemProcess;
use Aeon\Calendar\TimeUnit;

$process = SystemProcess::current();