> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP SDK webhooks

> Verify Telnyx ED25519 webhook signatures and parse typed webhook events with the PHP SDK.

Telnyx signs every webhook delivery with an ED25519 signature carried in the
`telnyx-signature-ed25519` and `telnyx-timestamp` request headers. The SDK's
webhook service verifies the signature against your account's public key and
parses the payload into a typed event.

Copy your public key from the Mission Control Portal and expose it as
`TELNYX_PUBLIC_KEY` — the client reads it automatically, the same way it reads
`TELNYX_API_KEY`:

```bash theme={null}
export TELNYX_PUBLIC_KEY="..."
```

## Verify and parse an event

Pass the raw request body and the request headers to
`$client->webhooks->unwrap()`:

```php theme={null}
<?php

require 'vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\WebhookException;

$client = new Client(); // reads TELNYX_API_KEY and TELNYX_PUBLIC_KEY

$body = file_get_contents('php://input');

try {
    $event = $client->webhooks->unwrap($body, getallheaders());
} catch (WebhookException $e) {
    http_response_code(400); // signature invalid or payload malformed
    exit;
}

http_response_code(200);
```

`unwrap()` throws `WebhookException` when the signature does not match or the
payload cannot be parsed, and returns the event as a typed union of every
webhook event the API sends.

## Skipping verification

`$client->webhooks->unsafeUnwrap($body)` parses a payload without checking the
signature. Only use it for payloads you have already verified by other means,
or in tests.

## Related

* [Receiving webhooks](/docs/development/api-fundamentals/webhooks/receiving-webhooks)
  covers delivery, retries, and failover URLs.
* [Errors and retries](/docs/development/sdk/php/errors-and-retries)
  covers the SDK's exception classes.
