PHP code example of shankao / daemonizer

1. Go to this page and download the library: Download shankao/daemonizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shankao / daemonizer example snippets


class example implements Daemonizer\Daemonizable {
  public function sleep_time() {
    return 1; // In seconds
  }
  
  public function run() {
    echo "Hey there!\n";
  }
}

$daemon = new Daemonizer\Daemonizer('example', '././example/example.pid');
// Add customizations. I.e: $daemon->set_logfn('my_logging_function');
$daemon->run(new example);

set_finishfn(callable $fn)

set_restartfn(callable $fn)

set_uid(int)

set_gid(int)

set_logfn(callable $fn)

set_loglevel(int)