saggre/process-manager
最新稳定版本:1.0.0
Composer 安装命令:
composer require saggre/process-manager
包简介
A library used to call external binaries with PHP
README 文档
README
A library used to call external binaries with PHP. It provides a simple interface to run processes, handle their input and output, and manage their execution.
Usage
With no output
try{ $result = (new ProcessService('/usr/bin/node')) ->setInput('--version') ->run(); echo $result->getExitCode(); // 0 } catch (ProcessCreateException|ProcessRunException $e) { // TODO: Handle exceptions }
With buffered output
try{ $stdoutStrategy = new BufferedOutputStrategy(); $result = (new ProcessService('/usr/bin/node')) ->setStdoutStrategy($stdoutStrategy) ->setInput('--version') ->run(); echo $stdoutStrategy->getOutput(); // v22.16.0 } catch (ProcessCreateException|ProcessRunException $e) { // TODO: Handle exceptions }
With streamed output
try{ $stdoutStrategy = new StreamedOutputStrategy( fn(string $data) => print $data // v22.16.0 )->setChunkLength(128); $result = (new ProcessService('/usr/bin/node')) ->setStdoutStrategy($stdoutStrategy) ->setInput('--version') ->run(); } catch (ProcessCreateException|ProcessRunException $e) { // TODO: Handle exceptions }
License
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC-BY-NC-4.0
- 更新时间: 2025-06-10