shippinno/heartbeat

There is no license information available for the latest version (v2.0.0) of this package.

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

This package is not auto-updated.

Last update: 2022-05-18 17:37:32 UTC


README

Scrutinizer Code Quality Code Coverage Build Status

Let the stuff heartbeat and monitor if it is alive.

Currently it only supports Dead Man's Snitch.

Installation

$ composer require shippinno/heartbeat

Usage

Set up a Heartbeater singleton, with a heart and channels.

$heartbeater = Heartbeater::instance();
$heartbeater->setHeart(new DeadMansSnitchHeart(new Client);
$heartbeater->setChannels([
    'vital' => 'SNITCH_TOKEN',
]);

Let it heartbeat forever.

class Dude
{
    public function live()
    {
        $alive = true;
        while ($alive) {
            Heartbeat::instance()->heartbeat('vital');
            sleep(1);
        }
    }
}