PHP code example of milpa / notifications
1. Go to this page and download the library: Download milpa/notifications library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
milpa / notifications example snippets
use Milpa\Notifications\NotificationDispatcher;
use Milpa\Notifications\NotificationPayload;
$dispatcher = (new NotificationDispatcher($logger))
->addChannel($telegramChannel); // implements Milpa\Notifications\Contracts\NotificationChannelInterface
$payload = new NotificationPayload(type: 'alert', title: 'Deploy finished');
// Targeted: "channel:recipient" — routed to the matching channel.
$dispatcher->dispatch($payload, ['telegram:123456']);
// Broadcast: the same recipient id across every registered channel.
$dispatcher->broadcast($payload, '123456');