aboutcoders / process-control
A PHP process control library
Installs: 22 238
Dependents: 3
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=5.3
- psr/log: ~1
Requires (Dev)
This package is not auto-updated.
Last update: 2024-12-19 01:10:36 UTC
README
A PHP process control library.
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.