tomaszdurka / php-exec
There is no license information available for the latest version (0.1.1) of this package.
0.1.1
2014-09-16 16:06 UTC
Requires
- evenement/evenement: ~2.0.0
Requires (Dev)
- phpunit/phpunit: ~4.1.3
- tomaszdurka/mocka: ~0.8.1
This package is auto-updated.
Last update: 2024-11-26 13:00:52 UTC
README
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();