PHP code example of phacman / php-process

1. Go to this page and download the library: Download phacman/php-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/ */

    

phacman / php-process example snippets


use PhacMan\Process\Exception\ProcessFailedException;
use PhacMan\Process\Process;

cess->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
*/