1. Go to this page and download the library: Download amphp/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/ */
amphp / process example snippets
mp\ByteStream;
use Amp\Process\Process;
// "echo" is a shell internal command on Windows and doesn't work.
$command = DIRECTORY_SEPARATOR === "\\" ? "cmd /c echo Hello World!" : "echo 'Hello, world!'";
$process = Process::start($command);
Amp\async(fn () => Amp\ByteStream\pipe($process->getStdout(), ByteStream\getStdout()));
Amp\async(fn () => Amp\ByteStream\pipe($process->getStderr(), ByteStream\getStderr()));
$exitCode = $process->join();
echo "Process exited with {$exitCode}.\n";