mkraemer/react-pcntl
最新稳定版本:v3.0.0
Composer 安装命令:
composer require mkraemer/react-pcntl
包简介
PCNTL bindings for ReactPHP
README 文档
README
Since v0.5 of ReactPHP event-loop offers native support for signal handling.
React-PCNTL
Basic PCNTL bindings for React PHP.
Install
The best way to install this library is through composer:
{
"require": {
"mkraemer/react-pcntl": "^3.0.*"
}
}
This library depends on the PCNTL extension.
Note: version 2 of this library requires PHP >= 5.4. If you are using PHP 5.3, use the 1.0.* version:
{
"require": {
"mkraemer/react-pcntl": "1.0.*"
}
}
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(); $pcntl = new MKraemer\ReactPCNTL\PCNTL($loop); $pcntl->on(SIGTERM, function () { // Clear some queue // Write syslog // Do ALL the stuff echo 'Bye'.PHP_EOL; die(); }); $pcntl->on(SIGINT, function () { echo 'Terminated by console'.PHP_EOL; die(); }); echo 'Started as PID '.getmypid().PHP_EOL; $loop->run();
统计信息
- 总下载量: 288.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 59
- 点击次数: 1
- 依赖项目数: 14
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-06