pahenrus/react-signals
Composer 安装命令:
composer require pahenrus/react-signals
包简介
Unix signals handling for ReactPHP
README 文档
README
Unix signals handler for React PHP.
##Install
The best way to install this library is through composer:
$ composer require pahenrus/react-signals
Usage
This library provides the PCNTL class which taskes an event loop and optionally the timer interval in which the PCNTL signals should be read as constructor arguments. After initializing the class, you can use the on() method to register event listeners to PCNTL signals.
$loop = React\EventLoop\Factory::create(); $signalsHandler = new Reac\Signals\Handler($loop); $signalsHandler->on(SIGTERM, function () { // Clear some queue // Write syslog // Do ALL the stuff echo 'Bye'.PHP_EOL; die(); }); $signalsHandler->on(SIGINT, function () { echo 'Terminated by console'.PHP_EOL; die(); }); echo 'Started as PID '.getmypid().PHP_EOL; $loop->run();
统计信息
- 总下载量: 3.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-27