Small library to abstract the way to halt the program.
composer require innmind/time-warp
use Innmind\TimeWarp\{
Halt\Usleep,
Halt,
};
use Innmind\TimeContinuum\Period;
function yourApp(Halt $halt): void
{
// do something
$halt(Period::minute(42))->unwrap();
// do some more
}
yourApp(Usleep::new());
This example will halt your program for 42 minutes.
use Innmind\TimeWarp\Halt\Logger;
use Psr\Log\LoggerInterface;
$halt = Logger::psr($halt, /** an instance of LoggerInterface */);