Skip to content

ragboyjr/pager-duty-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pager Duty API Client

Simple PHP Client for interacting with the Pager Duty API.

Installation

Install with composer at ragboyjr/pager-duty-client-client

Usage

<?php

use Ragboyjr\PagerDuty;

$events = new PagerDuty\GuzzleEventsApiClient(/* pass an optional custom GuzzleHttp\ClientInterface */);

$resp = $events->enqueue($routing_key, PagerDuty\EventsApi::ACTION_TRIGGER, [
    'summary' => 'My Alert Summary',
    'source' => 'sub.host.com',
    'severity' => PagerDuty\EventsApi::SEVERITY_INFO,
]);

if ($resp->isOk()) {
    var_dump($resp->getBody());
} else if ($resp->isError()) {
    var_dump($resp->getStatus());
    var_dump($resp->getBody());
    var_dump($resp->getHttpResponse());
}