https://github.com/ghostwriter/shell
Execute commands and external programs effortlessly in PHP
https://github.com/ghostwriter/shell
Last synced: about 1 year ago
JSON representation
Execute commands and external programs effortlessly in PHP
- Host: GitHub
- URL: https://github.com/ghostwriter/shell
- Owner: ghostwriter
- License: other
- Created: 2024-04-04T19:49:15.000Z (about 2 years ago)
- Default Branch: 0.1.x
- Last Pushed: 2025-04-22T13:09:12.000Z (about 1 year ago)
- Last Synced: 2025-04-22T14:24:54.065Z (about 1 year ago)
- Language: PHP
- Size: 481 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Shell
[](https://github.com/sponsors/ghostwriter)
[](https://github.com/ghostwriter/shell/actions/workflows/automation.yml)
[](https://www.php.net/supported-versions)
[](https://packagist.org/packages/ghostwriter/shell)
Execute commands and external programs
> [!WARNING]
> This project is not finished yet, work in progress.
## Installation
You can install the package via composer:
``` bash
composer require ghostwriter/shell
```
### Star ⭐️ this repo if you find it useful
You can also star (🌟) this repo to find it easier later.
## Usage
```php
$shell = Shell::new();
$shell->execute('cd', [sys_get_temp_dir()]);
$result = $shell->execute(PHP_BINARY, ['-r', 'echo "#BlackLivesMatter";']);
$exitCode = $result->exitCode(); // 0
if ($exitCode !== 0) {
throw new RuntimeException($result->stderr());
}
if ($exitCode === 0) {
echo $result->stdout(); // "#BlackLivesMatter"
}
```
### Credits
- [Nathanael Esayeas](https://github.com/ghostwriter)
- [All Contributors](https://github.com/ghostwriter/shell/contributors)
### Changelog
Please see [CHANGELOG.md](./CHANGELOG.md) for more information on what has changed recently.
### License
Please see [LICENSE](./LICENSE) for more information on the license that applies to this project.
### Security
Please see [SECURITY.md](./SECURITY.md) for more information on security disclosure process.