8000 GitHub - SimonFrings/reactphp-shell: Run async commands within any interactive shell command, built on top of ReactPHP.
[go: up one dir, main page]

Skip to content

SimonFrings/reactphp-shell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clue/reactphp-shell Build Status

Run async commands within any interactive shell command, built on top of ReactPHP.

Note: This project is in beta stage! Feel free to report any issues you encounter.

Quickstart example

Once installed, you can use the following code to run an interactive bash shell and issue some commands within:

$loop = React\EventLoop\Factory::create();
$launcher = new ProcessLauncher($loop);

$shell = $launcher->createDeferredShell('bash');

$shell->execute('echo -n $USER')->then(function ($result) {
    var_dump('current user', $result);
});

$shell->execute('env | sort | head -n10')->then(function ($env) {
    var_dump('env', $env);
});

$shell->end();

$loop->run();

See also the examples:

Install

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

$ composer require clue/shell-react:^0.2

See also the CHANGELOG for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 7+. It's highly recommended to use PHP 7+ for this project.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

$ composer install

To run the test suite, go to the project root and run:

$ php vendor/bin/phpunit

License

MIT

About

Run async commands within any interactive shell command, built on top of ReactPHP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%
0