itjamie/pagerdutywhosoncall

This package is abandoned and no longer maintained. No replacement package was suggested.

Pagerduty class for checking who is oncall including override schedules

0.6 2016-03-26 13:32 UTC

This package is not auto-updated.

Last update: 2021-11-13 10:55:24 UTC


README

(c) 2016 Jamie Murphy jamiemurphyit@gmail.com Installation

$ composer require itjamie/pagerdutywhosoncall

Basic Usage

	require 'vendor/autoload.php'; // if using php composer

	date_default_timezone_set('UTC'); // set the timezone of your php env to be the same you pass to pagerduty
	$pagerdutyapi = new PagerDutyWhosOncall(array(
            'baseurl' => 'https://instancename.pagerduty.com/api/v1/', 
            'apikey' => 'placeholderforyourapi',
            'debug' => false,
            'timezone' => 'UTC' // This is the timezone that will be passed to pagerduty. https://developer.pagerduty.com/documentation/rest/types#timezone
            )
	);
        
	$scheduleid = "abc123";


	echo ' Oncall Now :'.PHP_EOL;
	$result = $pagerdutyapi->whoIsOnCall( $scheduleid );
    var_dump($result);

	echo ' Oncall in one hour :'.PHP_EOL;
	$time = time()+60*60;
	$result = $pagerdutyapi->whoIsOnCall( $scheduleid, $time );
    var_dump($result);

Credits

Thanks to ozzd/PagerdutyPHP for some of the original code.