phacman / php-process
Compact version: Executes commands in sub-processes
v1.0.0
2023-10-28 09:51 UTC
Requires
- php: >=8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpunit/phpunit: ^9.5
README
The Process executes commands in sub-processes.
History with a list of original committers/commits: shortlog.txt
Getting Started
use PhacMan\Process\Exception\ProcessFailedException; use PhacMan\Process\Process; require dirname(__DIR__, 1).'/vendor/autoload.php'; $src = dirname(__DIR__).'/src'; $process = new Process(['ls', '-lsa', $src]); $process->run(); // executes after the command finishes if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } echo $process->getOutput(); /* total 88 4 drwxrwxr-x 4 some some 4096 окт 28 12:38 . 4 drwxrwxr-x 8 some some 4096 окт 28 12:42 .. 4 drwxrwxr-x 2 some some 4096 окт 28 12:38 Exception 4 -rw-rw-r-- 1 some some 2843 окт 28 12:38 ExecutableFinder.php 4 -rw-rw-r-- 1 some some 2424 окт 28 12:38 InputStream.php 4 -rw-rw-r-- 1 some some 2745 окт 28 12:38 PhpExecutableFinder.php 4 -rw-rw-r-- 1 some some 2425 окт 28 12:38 PhpProcess.php 4 drwxrwxr-x 2 some some 4096 окт 28 12:38 Pipes 52 -rw-rw-r-- 1 some some 52007 окт 28 12:38 Process.php 4 -rw-rw-r-- 1 some some 1961 окт 28 12:38 ProcessUtils.php */
Resources
- Original repository: https://github.com/symfony/process