friendsofhyperf/command-signals
最新稳定版本:v3.2.0-beta.1
Composer 安装命令:
composer require friendsofhyperf/command-signals
包简介
The signals component for Hyperf Command.
README 文档
README
The signals component for Hyperf Command.
Installation
composer require friendsofhyperf/command-signals
Usage
namespace App\Command; use FriendsOfHyperf\CommandSignals\Traits\InteractsWithSignals; use Hyperf\Command\Annotation\Command; use Hyperf\Command\Command as HyperfCommand; use Psr\Container\ContainerInterface; #[Command] class FooCommand extends HyperfCommand { use InteractsWithSignals; public function __construct(protected ContainerInterface $container) { parent::__construct('foo'); } public function configure() { parent::configure(); $this->setDescription('Hyperf Demo Command'); } public function handle() { $this->trap([SIGINT, SIGTERM], function ($signo) { $this->warn(sprintf('Received signal %d, exiting...', $signo)); }); sleep(10); $this->info('Bye!'); } }
Run
Ctrl + C
$ hyperf foo ^CReceived signal 2, exiting...
killall php
$ hyperf foo Received signal 15, exiting... [1] 51936 terminated php bin/hyperf.php foo
Contact
License
统计信息
- 总下载量: 22.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04