pnixx/daemon

Simple Daemon for PHP

Installs: 62

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/pnixx/daemon

1.0.1 2016-09-07 10:23 UTC

This package is not auto-updated.

Last update: 2025-09-28 01:59:54 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