PHP code example of takuya / php-daemonize-pcntl

1. Go to this page and download the library: Download takuya/php-daemonize-pcntl 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/ */

    

takuya / php-daemonize-pcntl example snippets




kuya\PhpDaemonize\PhpDaemonize;

/**
* Daemonize function
 */
$m = new PhpDaemonize();
$m->start(function () { sleep(1000); });
$m->stop();




kuya\PhpDaemonize\PhpDaemonize;

/**
* Daemonize function
 */
$m = new PhpDaemonize();
$m->start(function () { pcntl_exec('/usr/bin/sleep',[10]) });

#!/usr/bin/env php
onize\PhpDaemonize;


$name = 'my-server';
// start stop
PhpDaemonize::run_func(function(){
  pcntl_exec('/usr/bin/php',['artisan','serve'])
},$name);
shell
composer 
shell
name='php-daemonize-pcntl'
composer config repositories.$name \
vcs https://github.com/takuya/$name  
composer