PHPackages                             philiprehberger/php-webhook-relay-client - 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. [API Development](/categories/api)
4. /
5. philiprehberger/php-webhook-relay-client

ActiveLibrary[API Development](/categories/api)

philiprehberger/php-webhook-relay-client
========================================

PHP SDK + HMAC verifier for the Webhook Relay API

v0.1.0(3d ago)01↑2900%MITPHPPHP ^8.2CI passing

Since Jun 7Pushed 3d agoCompare

[ Source](https://github.com/philiprehberger/php-webhook-relay-client)[ Packagist](https://packagist.org/packages/philiprehberger/php-webhook-relay-client)[ Docs](https://github.com/philiprehberger/php-webhook-relay-client)[ RSS](/packages/philiprehberger-php-webhook-relay-client/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

philiprehberger/php-webhook-relay-client
========================================

[](#philiprehbergerphp-webhook-relay-client)

[![Tests](https://github.com/philiprehberger/php-webhook-relay-client/actions/workflows/tests.yml/badge.svg)](https://github.com/philiprehberger/php-webhook-relay-client/actions/workflows/tests.yml)[![Packagist Version](https://camo.githubusercontent.com/e13b6a2c896bd8cc0d7c08b8531dc2cbff065488ebf9ef6cd5da4c2177444daf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068696c69707265686265726765722f7068702d776562686f6f6b2d72656c61792d636c69656e742e737667)](https://packagist.org/packages/philiprehberger/php-webhook-relay-client)[![Last updated](https://camo.githubusercontent.com/724c2788c52177b36bf5c950da1002845442818b58055473553421cb4068da13/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f7068696c69707265686265726765722f7068702d776562686f6f6b2d72656c61792d636c69656e74)](https://github.com/philiprehberger/php-webhook-relay-client/commits/main)

PHP SDK + HMAC verifier for the [Webhook Relay API](https://webhook-relay.dcsuniverse.com). PHP 8.2+, zero dependencies (curl + json extensions only).

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

[](#installation)

```
composer require philiprehberger/php-webhook-relay-client
```

Verify an incoming webhook (receiver side)
------------------------------------------

[](#verify-an-incoming-webhook-receiver-side)

```
use PhilipRehberger\WebhookRelayClient\Signer;

$body = file_get_contents('php://input');   // raw bytes — DO NOT json_decode + re-encode
$header = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';

if (! Signer::verify(getenv('WEBHOOK_SECRET'), $body, $header)) {
    http_response_code(400);
    exit('Bad signature');
}

$event = json_decode($body, true);
// ... handle $event
```

The body must be the exact bytes received. `json_encode(json_decode(...))` will reorder keys or change whitespace and break the signature.

The format matches Stripe and Svix (`t=,v1=` over `"{ts}.{body}"` with HMAC-SHA256), so the same verifier accepts signatures from any sender using that convention.

Send an event (sender side)
---------------------------

[](#send-an-event-sender-side)

```
use PhilipRehberger\WebhookRelayClient\WebhookRelayClient;

$relay = new WebhookRelayClient(getenv('WEBHOOK_RELAY_KEY'));

$event = $relay->ingest(
    type: 'order.created',
    payload: ['order_id' => 42],
    idempotencyKey: 'order-42-created',
);

print $event['id'].PHP_EOL;
```

The client throws `WebhookRelayException` on 4xx/5xx with the RFC 7807 problem payload preserved:

```
use PhilipRehberger\WebhookRelayClient\WebhookRelayException;

try {
    $relay->ingest('', []);
} catch (WebhookRelayException $err) {
    echo $err->status.' '.$err->title.': '.$err->detail.PHP_EOL;
}
```

Subscriptions, deliveries, and the rest
---------------------------------------

[](#subscriptions-deliveries-and-the-rest)

```
$sub = $relay->createSubscription(
    url: 'https://my-app.example.com/webhooks',
    name: 'orders inbound',
    eventFilter: 'order.*',
);
echo $sub['signing_secret'].PHP_EOL;   // store this now — shown only once

$page = $relay->listDeliveries(['status' => 'failed']);

$relay->pauseSubscription($sub['id']);
$relay->resumeSubscription($sub['id']);
$rotated = $relay->rotateSubscriptionSecret($sub['id']);
```

For endpoints the typed surface doesn't cover (manual retry, dead-letters, webhook test probe) drop down to `request()`:

```
$relay->request('POST', '/v1/deliveries/'.$id.'/retry');
```

Compatible senders
------------------

[](#compatible-senders)

Use `Signer::sign()` to stand up a compatible sender for testing, or to verify your verifier matches the wire format:

```
$signed = Signer::sign('whsec_shared', $rawBody);
$ch = curl_init($receiverUrl);
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $rawBody,
    CURLOPT_HTTPHEADER => ['X-Webhook-Signature: '.$signed['header']],
    CURLOPT_RETURNTRANSFER => true,
]);
curl_exec($ch);
```

Pointing at a different host
----------------------------

[](#pointing-at-a-different-host)

```
$relay = new WebhookRelayClient(
    apiKey: $apiKey,
    baseUrl: 'https://relay.staging.internal',
);
```

Links
-----

[](#links)

- API:
- Docs:
- OpenAPI spec:
- Source:

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance99

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfd7d24cbbf32400fa13ce0bbe7a31edd2d66a6d4488eafdb3d64c5337bf0435?d=identicon)[philiprehberger](/maintainers/philiprehberger)

---

Top Contributors

[![philiprehberger-ha](https://avatars.githubusercontent.com/u/96364354?v=4)](https://github.com/philiprehberger-ha "philiprehberger-ha (2 commits)")

---

Tags

signatureverifywebhookapi clienthmacwebhook-relay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/philiprehberger-php-webhook-relay-client/health.svg)

```
[![Health](https://phpackages.com/badges/philiprehberger-php-webhook-relay-client/health.svg)](https://phpackages.com/packages/philiprehberger-php-webhook-relay-client)
```

###  Alternatives

[standard-webhooks/standard-webhooks

Standard Webhooks - Open source tools and guidelines for sending webhooks easily, securely, and reliably

1.7k109.5k20](/packages/standard-webhooks-standard-webhooks)

PHPackages © 2026

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