pnixx / daemon
简单的PHP守护进程
1.0.1
2016-09-07 10:23 UTC
Requires
- php: >=5.6.0
- ext-pcntl: *
- league/climate: ^3.2
This package is not auto-updated.
Last update: 2024-09-14 19:36:46 UTC
README
##PHP的守护进程类
简单的守护进程抽象类
##要求
- PHP 5.6+
- Composer
##安装
composer require pnixx/daemon
##使用
class Server extends PNixx\Daemon\Daemon { public function run() { while( !$this->stop ) { //working process } } protected function onShutdown() { } }
示例:后台运行
example/run -i /path/to/init.php --log_level debug --quiet
要列出所有命令,请使用--help
或-h
参数。
要在部署后重启进程,请使用--restart
或-r
参数。一个新的进程将等待完成所有正在运行的进程。
请参阅Delayed Job的工作示例
##信号
QUIT
- 等待处理完成然后退出TERM
/INT
- 立即终止进程然后退出
##作者
Sergey Odintsov,@pnixx