定制 clue/shell-react 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

clue/shell-react

最新稳定版本:v0.2.0

Composer 安装命令:

composer require clue/shell-react

包简介

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

README 文档

README

CI status installs on Packagist

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:

<?php

require __DIR__ . '/vendor/autoload.php';

$launcher = new Clue\React\Shell\ProcessLauncher();

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

$shell->execute('echo -n $USER')->then(function ($result) {
    var_dump('current user', $result);
}, function (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
});

$shell->execute('env | sort | head -n10')->then(function ($env) {
    var_dump('env', $env);
}, function (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
});

$shell->end();

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 8+. It's highly recommended to use the latest supported PHP version 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:

vendor/bin/phpunit

License

MIT

统计信息

  • 总下载量: 1.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 33
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 33
  • Watchers: 6
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-06