PHP Classes

PHP Execute Shell Command: Execute system command piping input and output

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 137 All time: 9,252 This week: 78Up
Version License PHP version Categories
exec 1.0.0MIT/X Consortium ...5Networking, PHP 5, Files and Folders, C...
Description 

Author

This package can execute system command piping input and output data sources.

It can take a given string and execute as a local command program.

The package can also connect the program input to a given input stream like a file or a network connection for instance to an HTTP server.

It can also define the destination of the regular and error output streams.

Picture of Payam Naderi
  Performance   Level  
Name: Payam Naderi <contact>
Classes: 15 packages by
Country: United States United States
Age: 41
All time rank: 2017286 in United States United States
Week rank: 206 Up24 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Documentation

Poirot\Exec

Execute system commands.

__STDIN__

// Execute Command Line:
$exec = new ExeProc();
$re = $exec->exec("md5sum");

// Open Http Socket Connection:
$tcpClient = new \Poirot\Stream\WrapperClient('http://www.raya-media.com:80', 'r');
$stream = new \Poirot\Stream\Streamable($tcpClient->getConnect());
# pipe all http data as input for command(md5sum)
$stream->pipeTo($re->pipes()->stdin());
# close write input data
$re->pipes()->stdin()->getResource()->close();

// Read Output result, as stream:
$md5 = $re->pipes()->stdout()->readLine();

if ($re->pipes()->to(iExecDescriptor::XCDSC_STDERR) !== '') {
    // get stderr messages
    // ...
}

// Close Process:
$re->close();

var_dump($md5); // md5 hash of website content: fa59c70d613d4d0085b4d869c46288c9

  Files folder image Files (10)  
File Role Description
Files folder imageInterfaces (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file ExeDescriptor.php Class Class source
Plain text file ExeProc.php Class Class source
Plain text file ExeProcuted.php Class Class source
Plain text file ExeProcutedPipes.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (10)  /  Interfaces  
File Role Description
Files folder imageProcess (2 files)
  Plain text file iExec.php Class Class source
  Plain text file iExecDescriptor.php Class Class source

  Files folder image Files (10)  /  Interfaces  /  Process  
File Role Description
  Plain text file iExecProcess.php Class Class source
  Plain text file iExecProcessPipe.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:137
This week:0
All time:9,252
This week:78Up