swiekenb/ pcntl
PCNTL进程控制库
v7.1.0
2024-08-03 13:17 UTC
Requires
- php: ^8.2
- ext-pcntl: *
- ext-posix: *
- ext-sockets: *
Requires (Dev)
- phpunit/phpunit: ^10.3
Conflicts
- ext-grpc: *
README
基于默认PCNTL和POSIX函数的简单易用的PHP线程化进程管理器。
更多信息
安装
composer require "sweikenb/pcntl"
基本用法
use Sweikenb\Library\Pcntl\ProcessManager; use Sweikenb\Library\Pcntl\Api\ChildProcessInterface; use Sweikenb\Library\Pcntl\Api\ParentProcessInterface; use Sweikenb\Library\Pcntl\Api\ProcessOutputInterface; $pm = new ProcessManager(); $pm->runProcess(function(ChildProcessInterface $child, ParentProcessInterface $parent, ProcessOutputInterface $output) { $output->stdout(sprintf('Hello World from PID: %d', $child->getId())); });