Skip to content

tomaszdurka/php-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhpExec

Super-simple library for executing shell commands in php. I have created it without knowledge of already mature (fulfiling my needs) library https://github.com/symfony/Process

Installation

Use composer:

{
  "require": {
    "tomaszdurka/php-exec": "~0.1.0"
  }
}

Code usage

$command = new Command('ls');
$result = $command->run();

$result->isSuccess();
$result->getOutput();
$result->getExitCode();
$result->getErrorOutput();

Events

Apart from basic usage you can listen to intercept specific Command events. All possible events are listed in example below:

$command = new Command('ls');
$command->on('start', function($pid) {
});
$command->on('stdout', function($output) {
});
$command->on('stderr', function($error) {
});
$command->on('stop', function($exitCode) {
});
$command->run();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages