PHP Library for interacting with PagerDuty REST API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

This package is no longer maintained

The pagerduty api will be changing soon (Oct 2018). I do not currently have a pagerduty account or an active php setup to develop against to update this package. I'd recommend switching to this package:


Library for interacting with PagerDuty REST API

currently only implements Events/Integration API:

Composer Install:

"nmcquay/pagerduty": "0.1.*"



$evt = new \PagerDuty\Event();
// service key found at https://<your subdomain>
$evt->setServiceKey('32 char GUID') 
    ->setDescription('an example description')
    //incident key will get set automatically by pagerduty response if not set here
    //->setIncidentKey('example001') //optional
    ->setClient('Example Client') //optional
    ->setClientUrl('') //optional
    ->setDetails( array('test' => 1) ) //optional
    //setDetail will add/alter a key to the details object
    ->setDetail( 'appended Detail key', 'with a value' ); //optional
$resp = $evt->trigger();

var_dump( $resp, $evt->toArray(), $evt->getIncidentKey() );

//now assuming everything worked, you should have triggered a pagerduty event
//we can acknowledge the event:
$resp = $evt->acknowledge();
var_dump( $resp );

//and we can resolve the event:
$resp = $evt->resolve();
var_dump( $resp );

// acknowledge() and resolve() require an incident_key to exist before 
// calling them

// You can also initialize an event using the same JSON format pageduty
// accepts (as a PHP array):
$evtB = new \PagerDuty\Event( array(    
      "service_key" => "32 char GUID",
      "incident_key" => "srv01/HTTP",
      "description" => "FAILURE on machine",
      "client" => "Sample Monitoring Service",
      "client_url" => "",
      "details" => array(
          "ping time" => "1500ms",
          "load avg" => "0.75"
) );