PHP code example of sweikenb / pcntl
1. Go to this page and download the library: Download sweikenb/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/ */
sweikenb / pcntl example snippets
composer
use Sweikenb\Library\Pcntl\ProcessManager;
use Sweikenb\Library\Pcntl\Api\ChildProcessInterface;
use Sweikenb\Library\Pcntl\Api\ParentProcessInterface;
use Sweikenb\Library\Pcntl\Api\ProcessOutputInterface;
$pm = new ProcessManager();
$pm->runProcess(function(ChildProcessInterface $child, ParentProcessInterface $parent, ProcessOutputInterface $output) {
$output->stdout(sprintf('Hello World from PID: %d', $child->getId()));
});