pnixx/daemon

Simple Daemon for PHP

1.0.1 2016-09-07 10:23 UTC

This package is not auto-updated.

Last update: 2024-10-26 20:20:52 UTC


README

#Daemon class for PHP

Simple daemon abstract class

##Requirements

  • PHP 5.6+
  • Composer

##Installation

composer require pnixx/daemon

##Usage

class Server extends PNixx\Daemon\Daemon {

	public function run() {
		while( !$this->stop ) {
			//working process
		}
	}

	protected function onShutdown() {
		
	}
}

Example run background:

example/run -i /path/to/init.php --log_level debug --quiet

For list all commands, please use --help or -h argument.

For restart process after deploy use --restart or -r argument. A new process will be waiting finish all running processes.

See working example on Delayed Job

##Signals

  • QUIT - Wait finish processing then exit
  • TERM / INT - Immediately kill processes then exit

##Author

Sergey Odintsov, @pnixx