PHP code example of braincrafted / background-process
1. Go to this page and download the library: Download braincrafted/background-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/ */
braincrafted / background-process example snippets
use Cocur\BackgroundProcess\BackgroundProcess;
$process = new BackgroundProcess('sleep 5');
$process->run();
use Cocur\BackgroundProcess\BackgroundProcess;
$process = new BackgroundProcess('sleep 5');
$process->run();
echo sprintf('Crunching numbers in process %d', $process->getPid());
while ($process->isRunning()) {
echo '.';
sleep(1);
}
echo "\nDone.\n";
// ...
if ($process->isRunning()) {
$process->stop();
}