mkraemer/react-pcntl
Fork: 12 Star: 58 (更新于 2024-10-29 14:09:15)
license: 暂无
Language: PHP .
PCNTL bindings for reactphp
最后发布版本: v2.2.0 ( 2016-11-16 22:24:26)
Warning: this project has been deprecated
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();
mkraemer/react-pcntl同语言 PHP最近更新仓库
2024-11-11 23:40:24 coollabsio/coolify
2024-11-06 20:45:55 schmittjoh/JMSSerializerBundle
2024-11-06 18:06:24 symfony/var-dumper
2024-11-06 18:04:49 symfony/symfony
2024-10-31 21:37:53 filamentphp/filament
2024-10-11 03:27:29 odan/slim4-skeleton