A PHP process control library.
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 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 executes multiple controllers in a chain to determine whether to exit a process.
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.