PHP code example of nick4fake / react-child-process
1. Go to this page and download the library: Download nick4fake/react-child-process 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/ */
$process->stdout->on('data', function ($chunk) {
echo $chunk;
});
$process->stdout->on('end', function () {
echo 'ended';
});
$process->stdout->on('error', function (Exception $e) {
echo 'error: ' . $e->getMessage();
});
$process->stdout->on('close', function () {
echo 'closed';
});
$process->stdin->write($data);
$process->stdin->end($data = null);
$process->stdin->close();
// …
$process = new Process('echo test');
$process = new Process('echo run && demo || echo failed');
$process = new Process('cat first && echo --- && cat second');
$first = new Process('cat first');
$first->start($loop);
$first->on('exit', function () use ($loop) {
$second = new Process('cat second');
$second->start($loop);
});
$process = new Process('yes');
$process = new Process('exec yes');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.