shippinno / heartbeat
此包最新版本(v2.0.0)没有提供许可信息。
v2.0.0
2021-12-15 13:48 UTC
Requires
- php: ^7.4
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- mockery/mockery: ^1.1
- phpunit/phpunit: ^7.3
- squizlabs/php_codesniffer: ^3.3
This package is not auto-updated.
Last update: 2024-09-19 04:26:28 UTC
README
让项目持续心跳,以监控其是否存活。
目前它仅支持死人之钉。
安装
$ composer require shippinno/heartbeat
使用
设置一个Heartbeater单例,带有心和频道。
$heartbeater = Heartbeater::instance(); $heartbeater->setHeart(new DeadMansSnitchHeart(new Client); $heartbeater->setChannels([ 'vital' => 'SNITCH_TOKEN', ]);
让它永久心跳。
class Dude { public function live() { $alive = true; while ($alive) { Heartbeat::instance()->heartbeat('vital'); sleep(1); } } }