1. Go to this page and download the library: Download rasuvaeff/context-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/ */
rasuvaeff / context-process example snippets
use Rasuvaeff\Context\ContextExpiredException;
use Rasuvaeff\Context\Process\ContextProcess;
use Symfony\Component\Process\Process;
try {
$exitCode = ContextProcess::run(
new Process(['convert', $in, '-resize', '50%', $out]),
$context, // e.g. the request or job context
callback: static fn(string $type, string $chunk) => $log->debug($chunk),
gracePeriod: 2.0, // SIGTERM → wait → SIGKILL
);
} catch (ContextExpiredException) {
// the budget ran out: the process is already stopped
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.