shippinno/heartbeat

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

Installs: 1 671

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

pkg:composer/shippinno/heartbeat

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

This package is not auto-updated.

Last update: 2025-10-02 09:06:49 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);
        }
    }
}