shippinno/heartbeat

此包最新版本(v2.0.0)没有提供许可信息。

v2.0.0 2021-12-15 13:48 UTC

This package is not auto-updated.

Last update: 2024-09-19 04:26:28 UTC


README

Scrutinizer Code Quality Code Coverage Build Status

让项目持续心跳,以监控其是否存活。

目前它仅支持死人之钉

安装

$ 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);
        }
    }
}