sweikenb/pcntl

PCNTL process control library

v6.0.0 2023-09-30 11:03 UTC

This package is auto-updated.

Last update: 2024-03-30 00:31:01 UTC


README

Simple and easy to use thread-based process manager for PHP based on default PCNTL and POSIX functions.

Build status

Further information:

Installation

composer require "sweikenb/pcntl"

Basic Usage

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()));
});