phil / standard-webhooks-bundle
Standard Webhooks in Symfony: verified incoming webhooks handed to your controllers, signed webhooks sent out, and each delivery processed only once.
Package info
github.com/parler-haut-interagir-librement/standard-webhooks-bundle
Type:symfony-bundle
pkg:composer/phil/standard-webhooks-bundle
Requires
- php: >=8.5
- phil/standard-webhooks: ^0.1@dev
- phil/url: ^0.1.3@dev
- psr/clock: ^1.0
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.6
- doctrine/doctrine-bundle: ^3.4
- doctrine/orm: ^3.8
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- symfony/clock: ^8.2
- symfony/console: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-client: ^8.2
- symfony/http-client-contracts: ^3.8
- symfony/remote-event: ^8.2
- symfony/routing: ^8.2
- symfony/webhook: ^8.2
Suggests
- doctrine/dbal: To keep the processed ids in a table
- symfony/console: For phil:standard-webhooks:generate-key
- symfony/http-client: To send webhooks with WebhookSender
- symfony/webhook: To sign the deliveries of webhook.transport, with webhook_transport
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 01:16:51 UTC
README
Verified webhook deliveries as controller arguments, and signed webhooks sent from Symfony.
phil/standard-webhooks-bundle brings Standard Webhooks 1.0.0
into a Symfony application. It reads the signing and verification keys from configuration and builds the receiver.
A controller takes the verified delivery as an argument. A malformed delivery gets a 400, and a refused one a 401
with its reason. The bundle sends one signed attempt over Symfony's HTTP client, or signs the deliveries of the
Webhook component's transport, keeps the processed ids in a table of a Doctrine connection, and ships a command that
generates keys.
It is for Symfony applications that receive webhooks from other services or send their own. The format, the
signatures and the verification rules live in phil/standard-webhooks, a plain PHP library. Use that library alone
outside Symfony.
The bundle plugs into the HTTP kernel through a controller argument resolver. The HTTP client, Doctrine DBAL, the
Console and the Webhook components are optional, each enabling the sender, the storage, the key command or the signed
webhook.transport. Processed ids are claimed without aborting the processing transaction, so de-duplication and
the work it guards share one transaction.
Status
| Part | State |
|---|---|
| Configuration: signing and verification keys, tolerance, audience, connection | Implemented and tested |
VerifiedWebhookResolver: the VerifiedWebhook controller argument |
Implemented and tested |
WebhookSender and DeliveryFailed |
Implemented and tested |
webhook.transport of the Webhook component, signed and guarded (webhook_transport) |
Implemented and tested |
DbalProcessedWebhooks, its table and schema listener |
Implemented and tested |
phil:standard-webhooks:generate-key |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, registering, the table. |
| Configuration | Every key, generating keys, the services, keys that change. |
| Receiving | The controller argument, the size of a body, the answers, a complete endpoint, several senders. |
| Sending | WebhookSender, retries, failures, the guard on receiver URLs, the Webhook component, which to use. |
| Storage | The table of processed ids, one receiver apart from another, claiming, the daily purge after processed_retention, upgrading from 0.1. |
| Extension points | What an application implements, configures, replaces or relies on. |
| Testing | How the bundle is tested. |
| Reference | Every type of the bundle. |
The protocol — headers, keys, signatures, the order of verification — is documented with phil/standard-webhooks.
Quick start
phil_standard_webhooks: signing_keys: ['%env(WEBHOOK_SIGNING_KEY)%'] verification_keys: ['%env(PARTNER_PUBLIC_KEY)%'] audience: shop
#[Route('/webhooks', methods: ['POST'])] public function __invoke(VerifiedWebhook $webhook): Response { // claim $webhook->id, process $webhook->envelope(), in one transaction return new Response(null, 204); } $id = $sender->send('https://partner.example/webhooks', $body); // a WebhookSender
Requirements
PHP 8.5 or later; phil/standard-webhooks 0.1, which requires ext-sodium; phil/url 0.1.3, which requires the intl,
mbstring and URI extensions; psr/clock 1.0; Symfony 8.2's dependency injection, config, HTTP foundation and HTTP
kernel. Symfony's HTTP client, Doctrine DBAL and ORM with DoctrineBundle, Symfony Console and Symfony Webhook are
optional.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.