PHP code example of danhvo / pagerduty
1. Go to this page and download the library: Download danhvo/pagerduty 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/ */
danhvo / pagerduty example snippets
use NotificationChannels\PagerDuty\PagerDutyChannel;
use NotificationChannels\PagerDuty\PagerDutyMessage;
use Illuminate\Notifications\Notification;
class SiteProblem extends Notification
{
public function via($notifiable)
{
return [PagerDutyChannel::class];
}
public function toPagerDuty($notifiable)
{
return PagerDutyMessage::create()
->setSummary('There was an error with your site in the {$notifiable->service} component.');
}
}
public function routeNotificationForPagerDuty()
{
return '99dc10c97a6e43c387bbc4f877c794ef';
}
Notification::route('PagerDuty', '[my integration key]')->notify(new BasicNotification);