MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

Notifier

MMO\admin\monitoring · 1 symbole · générée le 27 Oct 2026

class

Notifier

Notifier.php:22

Tells someone an incident opened, got worse or was resolved (Incidents): through the channels of the hub's notify list, each with the lowest level it cares about.

class MMO\admin\monitoring\Notifier
Espace de noms
MMO\admin\monitoring
- `{"type": "desktop"}` -- `notify-send` on this machine: the hub runs here, for the person sitting at it; - `{"type": "command", "command": "..."}` -- any command, the event in its environment (`HUB_EVENT`, `HUB_SUBJECT`, `HUB_LEVEL`, `HUB_MESSAGE`, `HUB_JSON`) and never in its text: a message cannot run anything; - `{"type": "webhook", "url": "https://..."}` -- a JSON POST `{text, events}` (Slack, Mattermost, Discord and Google Chat read its `text`); - `{"type": "mail", "to": "me@example.org"}` -- php's `mail()`, as configured on this machine. `"level": "critical"` keeps a channel for what is critical; a resolution is told on the channels its incident was. A channel failing is logged, never thrown: a broken webhook must not stop the next collection.
(new Notifier('my.oviepro', [['type' => 'desktop'], ['type' => 'webhook', 'url' => $url, 'level' => 'critical']]))->notify($events);

Propriétés2

channels

protected array $channels
Type
array

hub

protected string $hub
Type
string

Méthodes6

line($event)

Notifier.php:59
function line(array $event): string
$eventarray
retournestringone line for an event: [my.oviepro] CRITICAL server:ovh1 · disk space: 93 ≥ 90

notify($events)

Notifier.php:41
function notify(array $events): int
$eventsarray
retourneinthow many messages were sent

__construct($hub, $channels)

Notifier.php:27
function __construct(string $hub, array $channels = [])
$hubstringthe hub's name, at the start of every message
$channels = []array