Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ddrv/php-shell
https://github.com/ddrv/php-shell
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ddrv/php-shell
- Owner: ddrv
- License: mit
- Created: 2019-09-09T03:24:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-13T08:55:31.000Z (about 5 years ago)
- Last Synced: 2024-04-28T22:21:07.360Z (7 months ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ddrv/shell
# Install
```text
composer require ddrv/shell
```# Usage
## Local
```php
'test', 'APP_SECRET' => '$3cr3t'], true);/* or
$shell = new Ddrv\Shell\LocalShell();
$shell
->setCwd('/tmp')
->setEnv('APP_ENV', 'test')
->setEnv('APP_SECRET', '$3cr3t')
->mergeErrorsAndOutput();
*/$result = $shell->exec('ls -l');
var_dump($result->getExitCode()); // 0
var_dump($result->getOutput()); // list directories in /tmp
var_dump($result->getErrors()); // null
```## Descriptors
```php
setDescriptor(new WritablePipe(), ShellInterface::DESCRIPTOR_INPUT);
$shell->setDescriptor(new File('/tmp/out.txt', 'a'), ShellInterface::DESCRIPTOR_OUTPUT);
$shell->setDescriptor(new ReadablePipe(), ShellInterface::DESCRIPTOR_ERRORS);
```