|
1 | | -# reactphp-child-process-promise |
| 1 | +# ReactPHP Child Process Promise |
| 2 | +[](https://travis-ci.org/WyriHaximus/reactphp-child-process-promise) |
| 3 | +[](https://packagist.org/packages/WyriHaximus/react-child-process-promise) |
| 4 | +[](https://packagist.org/packages/WyriHaximus/react-child-process-promise) |
| 5 | +[](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-child-process-promise/?branch=master) |
| 6 | +[](https://packagist.org/packages/wyrihaximus/react-child-process-promise) |
| 7 | +[](https://travis-ci.org/WyriHaximus/reactphp-child-process-promise) |
| 8 | + |
| 9 | +Wrap a [ReactPHP child process](https://github.com/reactphp/child-process) in a promise, once the process ends the promise resolves with the exit code and `STDERR` and `STDOUT` buffers. |
| 10 | + |
| 11 | +### Installation ### |
| 12 | + |
| 13 | +To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`. |
| 14 | + |
| 15 | +``` |
| 16 | +composer require wyrihaximus/react-child-process-promise |
| 17 | +``` |
| 18 | + |
| 19 | +## Examples ## |
| 20 | + |
| 21 | +```php |
| 22 | +\WyriHaximus\React\childProcessPromise($loop, new Process('uptime'))->then(function ($result) { |
| 23 | + var_export($result); |
| 24 | + /** |
| 25 | + * Example output: |
| 26 | + * [ |
| 27 | + * 'buffers' => [ |
| 28 | + * 'stderr' => 'Error messages will go in this buffer', |
| 29 | + * 'stdout' => 'Normal output will go in this buffer', |
| 30 | + * ], |
| 31 | + * 'exitCode' => 0, |
| 32 | + * ] |
| 33 | + */ |
| 34 | +}); |
| 35 | +``` |
| 36 | + |
| 37 | +For ready to use examples see the [examples](https://github.com/WyriHaximus/reactphp-child-process-promise/tree/master/examples) directory |
| 38 | + |
| 39 | +## Contributing ## |
| 40 | + |
| 41 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 42 | + |
| 43 | +## License ## |
| 44 | + |
| 45 | +Copyright 2016 [Cees-Jan Kiewiet](http://wyrihaximus.net/) |
| 46 | + |
| 47 | +Permission is hereby granted, free of charge, to any person |
| 48 | +obtaining a copy of this software and associated documentation |
| 49 | +files (the "Software"), to deal in the Software without |
| 50 | +restriction, including without limitation the rights to use, |
| 51 | +copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 52 | +copies of the Software, and to permit persons to whom the |
| 53 | +Software is furnished to do so, subject to the following |
| 54 | +conditions: |
| 55 | + |
| 56 | +The above copyright notice and this permission notice shall be |
| 57 | +included in all copies or substantial portions of the Software. |
| 58 | + |
| 59 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 60 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 61 | +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 62 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 63 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 64 | +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 65 | +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 66 | +OTHER DEALINGS IN THE SOFTWARE. |
0 commit comments