PHPackages                             adilbaig/pagerduty - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. adilbaig/pagerduty

ActiveLibrary[HTTP &amp; Networking](/categories/http)

adilbaig/pagerduty
==================

PHP wrapper to PagerDuty Events API.

4.0.0(5mo ago)18764.5k—4.6%6MITPHPPHP &gt;=8.0

Since Apr 3Pushed 2mo agoCompare

[ Source](https://github.com/cheesegrits/pagerduty)[ Packagist](https://packagist.org/packages/adilbaig/pagerduty)[ Docs](https://github.com/adilbaig/pagerduty)[ RSS](/packages/adilbaig-pagerduty/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

PHP PagerDuty Events API
========================

[](#php-pagerduty-events-api)

PHP implementation of the [PagerDuty Events API V2](https://developer.pagerduty.com/api-reference/f80f5db9acbe3-pager-duty-v2-events-api)

[![Latest Stable Version](https://camo.githubusercontent.com/c645c3af43256ae3683cf429ba3747d5bd4e6d731050d35131ab719031c6af8e/68747470733a2f2f706f7365722e707567782e6f72672f6164696c626169672f7061676572647574792f762f737461626c652e737667)](https://packagist.org/packages/adilbaig/pagerduty) [![Total Downloads](https://camo.githubusercontent.com/90d2538981b881bbf5c69197b8d0fcc81effde4da48cdb70f7536af771251d68/68747470733a2f2f706f7365722e707567782e6f72672f6164696c626169672f7061676572647574792f646f776e6c6f6164732e737667)](https://packagist.org/packages/adilbaig/pagerduty)

New Maintainer
--------------

[](#new-maintainer)

`7th January 2026` ownership of this package has been transfered to me, @cheesegrits.

Many thanks to @adilbaig for authoring and maintaining this package and for making the effort to find and transfer to a new owner, rather than just abandoning it.

I doubt I will be making any major changes or adding new features, I simply needed the package as-is to support some long-term projects I work on. But if you need any changes or features, feel free to raise an issue.

Request for Maintainer
----------------------

[](#request-for-maintainer)

`8th June 2025` If you're interested in taking over the maintenance of this plugin, let me know.

*A bit of background.* I started this plugin many years ago while working at a fintech startup. Our Ops team relied on PagerDuty and we wanted to hook up our internal alerting systems to PD. I didn't quite like what was available. I wanted something that was simple and flexible, but nothing more. This plugin has long since fulfilled that purpose. Over time people have come to use, contribute and rely on it. It is [PD's recommended community plugin](https://developer.pagerduty.com/docs/api-client-libraries) and the most downloaded PD plugin [on Packagist](https://packagist.org/?query=pagerduty). I've long since moved on; from the startup, from PHP and from PagerDuty. It's time someone else took over the maintenance here.

Your mission, should you choose to accept it, is to upgrade this plugin to PHP 8.4. Fork this repo, make the changes and send me a PR. Once committed, I will transfer ownership of the repo over.

**Update (2025-12-10):** @cheesegrits will be taking over maintenance of this project.

Compatibility
-------------

[](#compatibility)

1. **v4.**\*: Requires `"php": ">=8.0"` . PagerDuty Events API V2.
2. **v3.**\*: Requires `"php": ">=5.4.0"`. PagerDuty Events API V2. *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`*
3. **v2.**\*: Requires `"php": ">=5.4.0"`. PagerDuty Events API V1.

Features
--------

[](#features)

- Compatible with [PagerDuty Events API V2](https://developer.pagerduty.com/api-reference/f80f5db9acbe3-pager-duty-v2-events-api).
- Trigger, Acknowledge and Resolve incidents.
- Attach [Links](https://developer.pagerduty.com/docs/events-api-v2/trigger-events/#the-links-property) and [Images](https://developer.pagerduty.com/docs/events-api-v2/trigger-events/#the-images-property) to your incident reports.
- Unit Tests

Installation
------------

[](#installation)

For **PHP 8.\*** projects, add this line to your project's `composer.json`

```
{
...
    "require": {
        "adilbaig/pagerduty": "4.*"
    }
...
}

```

For PHP versions &lt; 8, add this line to your project's `composer.json`

```
{
...
    "require": {
        "adilbaig/pagerduty": "3.*"
    }
...
}

```

The packagist URL is

Usage
-----

[](#usage)

Trigger an event

```
use \PagerDuty\TriggerEvent;
use \PagerDuty\Exceptions\PagerDutyException;

$routingKey = "1d334a4819fc4b67a795b1c54f9a"; //Replace this with the integration key of your service.

// In this example, we're triggering a "Service is down" message from a web server.
try {
    $event = new TriggerEvent(
        $routingKey,
        "Service is down",  // A high-level, text summary message of the event. Will be used to construct an alert's description.
        "web-server-01",    // human-readable unique identifier, such as a hostname, for the system having the problem.
        TriggerEvent::ERROR,// How impacted the affected system is? Influences the priority of any created incidents.
        true                // Generate the dedup_key from the driver. If false, the dedup_key will be generated on PD
    );
    $responseCode = $event->send();
    if($responseCode == 200)
        echo "Success";
    elseif($responseCode == 429)
        echo "Rate Limited";  //You're being throttled. Slow down.
    else // An error occured. Try again later
        echo "Some error has occured. Try again later";
} catch(PagerDutyException $exception) { //This doesn't happen unless you've broken their guidelines. The API tries to minimize user mistakes
    var_dump($exception->getErrors());
}
```

Trigger event with custom connection, for example: using proxies and/or setting verbosity for debugging, etc.

```
use \PagerDuty\TriggerEvent;
use \PagerDuty\Exceptions\PagerDutyException;
use \PagerDuty\Http\PagerDutyHttpConnection;

try {
    $routingKey = '1d334a4819fc4b67a795b1c54f9a';  //Replace this with the integration key of your service.

    $event = new TriggerEvent(
        $routingKey,
        "Service is down",  // A high-level, text summary message of the event. Will be used to construct an alert's description.
        "web-server-01",    // human-readable unique identifier, such as a hostname, for the system having the problem.
        TriggerEvent::ERROR,// How impacted the affected system is? Influences the priority of any created incidents.
        true                // Generate the dedup_key from the driver. If false, the dedup_key will be generated on PD
    );

    // create a custom proxy connection
    $connection = new PagerDutyHttpConnection();

    // .. and set the proxy
    $connection->setProxy('https://user:password@your-proxy-ip-address:port');

    // set custom CURL options. Here we set verbosity for debugging
    $connection->addCurlOption('CURLOPT_VERBOSE', 1);

    // send event through proxy
    $connection->send($event);
}
catch(PagerDutyException $exception) { //This doesn't happen unless you've broken their guidelines. The API tries to minimize user mistakes
    var_dump($exception->getErrors());
}
catch (\Exception $e) {
    // A configuration exception
}
```

Automatically send only one PagerDuty incident for repeated errors

```
//You will only see one incident on PD
(TriggerEvent($routingKey, "Service is down", "web-server-01", TriggerEvent::ERROR, true))->send();
(TriggerEvent($routingKey, "Service is down", "web-server-01", TriggerEvent::ERROR, true))->send();
(TriggerEvent($routingKey, "Service is down", "web-server-01", TriggerEvent::ERROR, true))->send();
```

Create a detailed 'trigger' event, add optional data. Dump the event and inspect response from PD

```
use \PagerDuty\TriggerEvent;

//Taken from the `trigger` example @ https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2
//Send a detailed event, and store the `dedup_key` generated on the server

$event = new TriggerEvent(
    $routingKey,
    "Example alert on host1.example.com",
    "monitoringtool:cloudvendor:central-region-dc-01:852559987:cluster/api-stats-prod-003",
    TriggerEvent::INFO
);
$event
    ->setPayloadTimestamp("2015-07-17T08:42:58.315+0000")
    ->setPayloadComponent("postgres")
    ->setPayloadGroup("prod-datapipe")
    ->setPayloadClass("deploy")
    ->setPayloadCustomDetails(["ping_time" => "1500ms", "load_avg" => 0.75])
    ->addLink("https://example.com/", "Link text")
    ->addImage("https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png", "https://example.com/", "Example text"))
;

// 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.
$response = null;
$responseCode = $event->send($response);
// In this case, we will save the `dedup_key` generated by the PD server
var_dump($response['dedup_key']);
```

Acknowledge an event
--------------------

[](#acknowledge-an-event)

```
(new AcknowledgeEvent($routingKey, "dedup key"))->send();
```

Resolve an event
----------------

[](#resolve-an-event)

```
(new ResolveEvent($routingKey, "dedup key"))->send();
```

UnitTests
---------

[](#unittests)

```
> ./vendor/bin/phpunit test/
.....                                                               5 / 5 (100%)

Time: 37 ms, Memory: 4.00MB

OK (5 tests, 6 assertions)
```

Questions
---------

[](#questions)

**Q.** How do i get the service key from PagerDuty?

**A.** In your PagerDuty console, click 'Configuration' &gt; 'Services'. Click the link under 'Integrations' column. It's the 'Integration Key'

Read more here :

Requirements
------------

[](#requirements)

This library needs the [curl pecl extension](https://php.net/curl).

In Ubuntu 16.04, install it like so :

```
sudo apt install php-curl

```

In Ubuntu 18.04, install it like so :

```
sudo apt install php8.3-curl

```

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance78

Regular maintenance activity

Popularity47

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~711 days

Recently: every ~687 days

Total

7

Last Release

160d ago

Major Versions

1.0.0 → 2.0.02016-10-11

2.1.0 → 3.0.02018-09-14

3.2.0 → 4.0.02025-12-10

PHP version history (2 changes)2.0.0PHP &gt;=5.4.0

4.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/826fa86e4930c9a52697c428cee6ef0f32d86f5416af9190aba906af27579ae8?d=identicon)[cheesegrits](/maintainers/cheesegrits)

---

Top Contributors

[![cheesegrits](https://avatars.githubusercontent.com/u/934456?v=4)](https://github.com/cheesegrits "cheesegrits (2 commits)")[![jmgibson1976](https://avatars.githubusercontent.com/u/1045886?v=4)](https://github.com/jmgibson1976 "jmgibson1976 (2 commits)")[![adilbaig](https://avatars.githubusercontent.com/u/298606?v=4)](https://github.com/adilbaig "adilbaig (1 commits)")[![arielpts](https://avatars.githubusercontent.com/u/868079?v=4)](https://github.com/arielpts "arielpts (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![mattdudys](https://avatars.githubusercontent.com/u/77857?v=4)](https://github.com/mattdudys "mattdudys (1 commits)")

---

Tags

pagerdutyphpphp-pagerdutyrestPagerDuty

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adilbaig-pagerduty/health.svg)

```
[![Health](https://phpackages.com/badges/adilbaig-pagerduty/health.svg)](https://phpackages.com/packages/adilbaig-pagerduty)
```

###  Alternatives

[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[psr/link

Common interfaces for HTTP links

2.5k144.1M68](/packages/psr-link)[league/fractal

Handle the output of complex data structures ready for API output.

3.5k64.1M476](/packages/league-fractal)[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k58.7M210](/packages/lexik-jwt-authentication-bundle)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
