composer require "primipilus/daemon:~2.0"
class TestDaemon extends \primipilus\daemon\BaseDaemon
{
protected function process() : void
{
// ...
}
}
$daemon = new TestDaemon(['daemonize' => true, 'runtimeDir' => __DIR__]);
$daemon->start();
// or
$daemon->stop();