1. Go to this page and download the library: Download ncrypthic/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.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ncrypthic / daemon example snippets
use Ncrypthic\Daemon\Interfaces\ProcessInterface;
class AliceProcess implements ProcessInterface
{
public function execute()
{
sleep(3);
echo 'Alice done'.PHP_EOL;
exit;
}
}
class BobProcess implements ProcessInterface
{
public function execute()
{
sleep(3);
echo 'Bob done'.PHP_EOL;
exit;
}
}
// ... Other commands
$manager = new \Ncrypthic\Daemon\Manager\DefaultManager();
$manager->addProcess(new AliceProcess());
$manager->addProcess(new BobProcess());
bash-4.2$ php <your_script>.php
Alice done
Bob done
No child processes
Alice done
Bob done
No child processes
Alice done
Alice done
Bob done
No child processes
Alice done
Bob done
No child processes
Alice done
php
`+-php
+-php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.