Package Data | |
---|---|
Maintainer Username: | laravel-notification-channels |
Maintainer Contact: | lwaite@gmail.com (Luke Waite) |
Package Create Date: | 2017-05-11 |
Package Last Update: | 2022-02-06 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-17 03:04:31 |
Package Statistics | |
---|---|
Total Downloads: | 26,134 |
Monthly Downloads: | 33 |
Daily Downloads: | 6 |
Total Stars: | 5 |
Total Watchers: | 6 |
Total Forks: | 10 |
Total Open Issues: | 4 |
This package makes it easy to send notification events to PagerDuty with Laravel 5.3.
You can install the package via composer:
composer require laravel-notification-channels/pagerduty
Now you can use the channel in your via()
method inside the Notification class.
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.');
}
}
In order to let your Notification know which Integration should receive the event, add the routeNotificationForPagerDuty
method to your Notifiable model.
This method needs to return the Integration Key for the service and integration to which you want to send the event.
public function routeNotificationForPagerDuty()
{
return '99dc10c97a6e43c387bbc4f877c794ef';
}
On a PagerDuty Service of your choice, create a new Integration using the Events API v2
.
The Integration Key
listed for your new integration is what you need to set in the routeNotificationForPagerDuty()
method.
resolve()
: Sets the event type to resolve
to resolve issues.setDedupKey('')
: Sets the dedup_key
(required when resolving).setSummary('')
: Sets a summary message on the event.setSource('')
: Sets the event source; defaults to the hostname
.setSeverity('')
: Sets the event severity; defaults to critical
.setTimestamp('')
: Sets the timestamp
of the event.setComponent('')
: Sets the component
of the event.setGroup('')
: Sets the group
of the event.setClass('')
: Sets the class
.addCustomDetail('', '')
: Adds a key/value pair to the custom_detail
of the event.See the PagerDuty v2 Events API documentation for more information about what these options will do.
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email lwaite@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.