globaltriangles / shell-commander
Extension that allows the execution of shell commands directly to the server supporting general output and errors
1.1.0
2021-09-23 17:53 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-04-19 07:03:25 UTC
README
This is a small php composer plugin to execute shell commands with support of regular output and errors during execurtion
Installation
Use the package manager composer to install shell-commander.
composer require globaltriangles/shell-commander
Usage
use ShellCommander\Commander; //the string of the command to execute is this case a simple ls $command = 'ls'; //Call the static method an Execute the command saving the outputs to a variable $exec = Commander::exec($command); if(! empty($exec['output'])) { //Do Something with the output string like so... echo $exec['output']; } if(! empty($exec['error'])) { //Do Something with the error string like so... echo $exec['error']; }
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.