phore/system

Execute shell commands

Installs: 9 404

Dependents: 16

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 1

Language:Shell

v1.1.0 2022-10-21 23:12 UTC

This package is auto-updated.

Last update: 2024-12-09 19:28:26 UTC


README

This documentation is written along the guidelines of educational grade documentation discussed in the infracamp project. Please ask and document issues.

Goals

  • Secure and easy-to-use wrapper around exec()

Quickstart

phore_exec

$return = phore_exec("ls -l :path", ["path"=>"some Path "])
echo $return;

phore_proc

  • Read STDOUT/STDERR:
$result = phore_proc("ls -l *", ["/some/path"])->wait();
echo "\nStderr: " . $result->getSTDERRContents(); 
echo "\nStdOut: " . $result->getSTDOUTContents();
  • Read stream
$result = phore_proc("ls -l *", ["/some/path"])
    ->watch(1, function ($data, $len, PhoreProc $proc) use () {
        if ($data === null) {
            echo "End of stream";
            return;
        }
        echo "Steam in: $data";
    })->wait();
echo "\nStderr: " . $result->getSTDERRContents(); 

Installation

We suggest using composer:

composer require phore/system