aboutcoders/process-control

1.3.2 2016-12-30 15:26 UTC

README

A PHP process control library.

Build Status: Build Status

The interface

The ControllerInterface defines the method doExit() that indicates whether to exist a process.

interface ControllerInterface
{
    /**
     * Indicates whether to exit a process
     *
     * @return boolean
     */
    public function doExit();
}

The PcntlController

The PcntlController listens to PCNTL events to determine whether to exit a process.

    $stopsignals = array(SIGTERM);
    $logger = new Psr\Log\NullLogger();

    $controller = new PcntlController($stopsignals, $logger);

    while(!$controller->doExit())
    {
        // do something
    }

The ChainController

The ChainController executes multiple controllers in a chain to determine whether to exit a process.

The NullController

The NullController never indicates to exit a process.

Note: This controller can be used as fallback controller for the PcntlController in runtime environments where PCNTL functions to not exist.