https://github.com/phore/phore-system
Wrappers for exec
https://github.com/phore/phore-system
Last synced: 5 months ago
JSON representation
Wrappers for exec
- Host: GitHub
- URL: https://github.com/phore/phore-system
- Owner: phore
- License: mit
- Created: 2018-07-18T14:06:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-09T18:23:15.000Z (about 2 years ago)
- Last Synced: 2024-08-11T08:33:23.861Z (almost 2 years ago)
- Language: Shell
- Homepage: https://infracamp.org/project/phore/
- Size: 24.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phore System :: Wrapper to exec()
This documentation is written along the guidelines of educational grade documentation discussed in the
[infracamp](https://github.com/infracamp/infracamp/blob/master/DOCUMENTATION_GUIDE.md) project. Please ask and
document issues.
## Goals
- Secure and easy-to-use wrapper around `exec()`
## Quickstart
**phore_exec**
```php
$return = phore_exec("ls -l :path", ["path"=>"some Path "])
echo $return;
```
**phore_proc**
- Read STDOUT/STDERR:
```php
$result = phore_proc("ls -l *", ["/some/path"])->wait();
echo "\nStderr: " . $result->getSTDERRContents();
echo "\nStdOut: " . $result->getSTDOUTContents();
```
- Read stream
```php
$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](http://getcomposer.com):
```
composer require phore/system
```