PHPackages                             norberttech/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. norberttech/pagerduty

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

norberttech/pagerduty
=====================

Fork of adilbaig/pagerduty - PHP wrapper to PagerDuty Events API.

4.0.1(3y ago)042.4k1MITPHPPHP ~8.1 || ~8.2

Since Apr 3Pushed 3y agoCompare

[ Source](https://github.com/norberttech/pagerduty)[ Packagist](https://packagist.org/packages/norberttech/pagerduty)[ Docs](https://github.com/adilbaig/pagerduty)[ RSS](/packages/norberttech-pagerduty/feed)WikiDiscussions 4.x Synced today

READMEChangelog (2)Dependencies (2)Versions (9)Used By (0)

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

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

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

> This repository is a fork of adilbaig/pagerduty that seems to not be maintained anymore.

UPGRADE NOTICE
--------------

[](#upgrade-notice)

The [PagerDuty Events API V2](https://v2.developer.pagerduty.com/docs/events-api-v2) is **not backwards compatible** with the [PagerDuty 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`

[![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)

Features
--------

[](#features)

- Compatible with [PagerDuty Events API V2](https://developer.pagerduty.com/docs/events-api-v2/trigger-events/).
- 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)

Add this line to your project's `composer.json`

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

```

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 php7.2-curl

```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 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 ~402 days

Recently: every ~322 days

Total

9

Last Release

1256d ago

Major Versions

1.0.0 → 2.0.02016-10-11

2.1.0 → 3.0.02018-09-14

3.2.0 → 4.0.02023-01-24

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

4.0.0PHP ~8.1 || ~8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52325810?v=4)[norbert-tech](/maintainers/norbert-tech)[@norbert-tech](https://github.com/norbert-tech)

---

Top Contributors

[![jmgibson1976](https://avatars.githubusercontent.com/u/1045886?v=4)](https://github.com/jmgibson1976 "jmgibson1976 (2 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)")[![norberttech](https://avatars.githubusercontent.com/u/1921950?v=4)](https://github.com/norberttech "norberttech (1 commits)")

---

Tags

restPagerDuty

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[zircote/swagger-php

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

5.3k144.5M600](/packages/zircote-swagger-php)[psr/link

Common interfaces for HTTP links

2.5k152.8M84](/packages/psr-link)[league/fractal

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

3.8k67.2M554](/packages/league-fractal)[friendsofsymfony/rest-bundle

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

2.8k75.9M343](/packages/friendsofsymfony-rest-bundle)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k62.6M257](/packages/lexik-jwt-authentication-bundle)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M263](/packages/nelmio-api-doc-bundle)

PHPackages © 2026

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