greendrake/php-asyncprocess
最新稳定版本:1.0.0
Composer 安装命令:
composer require greendrake/php-asyncprocess
包简介
ReactPHP Promise implementation for truly asynchronous background processes
README 文档
README
ReactPHP Promise implementation for truly asynchronous background processes.
This library allows to run commands in background shaped as ReactPHP Promises. Non-blocking. Tested on Linux only.
Under the hood, it works this way:
-
A child process is forked using pcntl_fork. This runs the specified command and reports the result back to the parent process via a local HTTP call (using a one-off reactphp/http server/client).
-
Once the parent process gets the result, it fulfils (or rejects, depending on the exit code) the Promise. Profit.
Example:
use function React\Async\await; $p = new \Greendrake\AsyncProcess\Promise('a=$( expr 10 - 3 ); echo $a'); // Kick off the process in background. $result = await($p->get()); // Get the instance of React\Promise\Promise, wait for it to resolve. echo $result; // outputs "7"
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-10-14