Process management based on ext-pcntl and ext-posix

v1.0.0 2019-01-11 05:54 UTC

This package is auto-updated.

Last update: 2022-11-11 15:22:58 UTC


The following versions of PHP are supported.

  • PHP 7.0+


To install, use composer:

php composer.phar require pe/component-process


Simple manager usage:


namespace PE\Component\Process;

// Instantiate manager
$manager = new Manager();

// Create process
$process = new Process(function (Process $process) {
    //TODO do some stuff...

// Execute process
$manager->fork($process);// <-- this will be ignored because we set max executed processes

// Wait until processes completed

Demonize any long executed code:


namespace PE\Component\Process;

use Psr\Log\NullLogger;

// Define path to pid file, must be writable by php user
$pidPath = sys_get_temp_dir() . '/';

// Instantiate a daemon
$daemon = new Daemon(function () {
    //TODO do some stuff...
}, $pidPath);

// Instantiate logger
$logger = new NullLogger();

// Start execution in background

// You can check if daemon is still running by call:

// You can break execution by call: