1. Go to this page and download the library: Download wapmorgan/system-daemon library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wapmorgan / system-daemon example snippets
// adjust here path to composer autoloader!usewapmorgan\SystemDaemon\DaemonManager;
$daemon = new AbstractDaemon();
$daemon->name = 'example';
$daemon->setLogger(AbstractDaemon::FILES);
(new DaemonManager($daemon))->handleConsole($argc, $argv);
classMyDaemonextendsAbstractDaemon{
protectedfunctiononStart(){
// here's your daemon's code
}
}
$daemon = new MyDaemon(AbstractDaemon::TICKABLE, 2); // this daemon will "tick" every 2 seconds
classMyDaemonextendsAbstractDaemon{
protectedfunctiononTick(){
// here's your daemon's code on every tick
}
}