定制 greendrake/php-asyncprocess 二次开发

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

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

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:

  1. 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).

  2. 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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-10-14