You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-37Lines changed: 61 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,55 +1,59 @@
1
1
PHP PagerDuty Events API
2
2
=========
3
-
PHP implementation of the [PagerDuty Events API](https://v2.developer.pagerduty.com/v2/docs/events-api)
3
+
PHP implementation of the [PagerDuty Events API V2](https://v2.developer.pagerduty.com/docs/events-api-v2)
4
4
5
-
**Important**: v2 is a complete rewrite of the library. It is not backwards compatible with v1.
6
5
7
-
For all new projects i suggest using v2. It is more flexible and easier to use than v1, and overcomes some of its predecessor's design limitations.
6
+
UPGRADE NOTICE
7
+
---
8
+
The [Events API V2](https://v2.developer.pagerduty.com/docs/events-api-v2) is **not backwards compatible** with the [Events API V1](https://v2.developer.pagerduty.com/docs/events-api). Hence, this API has changed. If you are upgrading from a [2.* release](https://github.com/adilbaig/pagerduty/releases), make sure you pay attention to the contructor of the `TriggerEvent`
// Pass in the '$response' variable by reference if you want to inspect PD's response. This is optional, and you probably don't need this in production.
91
101
$response = null;
92
102
$responseCode = $event->send($response);
93
-
var_dump($response);
103
+
// In this case, we will save the `dedup_key` generated by the PD server
104
+
var_dump($response['dedup_key']);
94
105
````
95
106
96
107
Acknowledge an event
108
+
----
97
109
98
110
````php
99
-
(new AcknowledgeEvent($serviceKey, "incident key"))->send();
111
+
(new AcknowledgeEvent($routingKey, "dedup key"))->send();
100
112
````
101
113
102
114
Resolve an event
103
-
115
+
----
104
116
````php
105
-
(new ResolveEvent($serviceKey, "incident key"))->send();
117
+
(new ResolveEvent($routingKey, "dedup key"))->send();
118
+
````
119
+
120
+
UnitTests
121
+
---
122
+
123
+
````bash
124
+
> ./vendor/bin/phpunit test/
125
+
..... 5 / 5 (100%)
126
+
127
+
Time: 37 ms, Memory: 4.00MB
128
+
129
+
OK (5 tests, 6 assertions)
106
130
````
107
131
108
132
Questions
109
-
----
133
+
---
110
134
111
135
**Q.** How do i get the service key from PagerDuty?
112
136
@@ -115,7 +139,7 @@ Questions
115
139
Read more here : https://v2.developer.pagerduty.com/v2/docs/events-api#getting-started
116
140
117
141
Requirements
118
-
----
142
+
---
119
143
This library needs the [curl pecl extension](https://php.net/curl).
* @param array $result (Opt)(Pass by reference) - If this parameter is given the result of the CURL call will be filled here. The response is an associative array.
62
-
*
62
+
*
63
63
* @throws PagerDutyException - If status code == 400
64
-
*
64
+
*
65
65
* @return int - HTTP response code
66
-
* 200 - Event Processed
66
+
* 202 - Event Processed
67
67
* 400 - Invalid Event. Throws a PagerDutyException
68
68
* 403 - Rate Limited. Slow down and try again later.
0 commit comments