PHP code example of ragboyjr / pager-duty-client

1. Go to this page and download the library: Download ragboyjr/pager-duty-client 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/ */

    

ragboyjr / pager-duty-client example snippets




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());
}