Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rbarilani/nixshell
A minimalistic php object oriented ```exec``` wrap.
https://github.com/rbarilani/nixshell
Last synced: about 1 month ago
JSON representation
A minimalistic php object oriented ```exec``` wrap.
- Host: GitHub
- URL: https://github.com/rbarilani/nixshell
- Owner: rbarilani
- Created: 2015-06-07T22:53:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-10T20:31:16.000Z (over 9 years ago)
- Last Synced: 2024-11-09T07:31:51.374Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 172 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
rbarilani/nixshell
==================A minimalistic php object oriented ```exec``` wrap.
[![Build Status](https://travis-ci.org/rbarilani/nixshell.svg)](https://travis-ci.org/rbarilani/nixshell)
[![Code Coverage](https://scrutinizer-ci.com/g/rbarilani/nixshell/badges/coverage.png)](https://scrutinizer-ci.com/g/rbarilani/nixshell)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/rbarilani/nixshell/badges/quality-score.png)](https://scrutinizer-ci.com/g/rbarilani/nixshell)## Install
Adds this to your composer.json and run ```composer update rbarilani/nixshell```:
```json
{
"require": {
"rbarilani/nixshell" : "dev-master"
},
"repositories" : [
{ "type":"git", "url":"https://github.com/rbarilani/nixshell.git" }
]
}
```## Usage
```php
exec('ls');$result->getExitCode(); // 0
$result->getOutput(); // ["dir1","dir2","etc"]// unsuccessful command
try {
$shell->exec('cat not-existent-file');}catch(ExecException $e) {
$e->getExitCode(); // 1
$e->getMessage(); // "cat: not-existent-file: No such file or directory (executed:'cat not-existent-file', exit code:1)"
$e->getOutput(); // [""cat: not-existent-file: No such file or directory"]
}// history
$shell->getHistory(); // ["ls","cat not-existent-file"]// clear history
$shell->clearHistory(); // []```
## Development
Contributions are highly welcome.
Just clone the repository and submit your contributions as pull requests.