snb4crazy / webhook-manager-laravel
Queue-aware webhook sender and signature verifier for Laravel apps.
Package info
github.com/snb4crazy/webhook-manager-laravel
pkg:composer/snb4crazy/webhook-manager-laravel
Requires
- php: ^8.2
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- illuminate/database: ^10.0|^11.0|^12.0|^13.0
- illuminate/http: ^10.0|^11.0|^12.0|^13.0
- illuminate/queue: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- mockery/mockery: ^1.6
- nunomaduro/collision: ^7.0|^8.0
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2026-08-01 04:14:52 UTC
README
Queue-aware webhook delivery package for Laravel with HMAC signing, signature verification, retries, and delivery logs.
Features
Webhook::send(...)for outbound webhook deliveryWebhook::verify(...)for inbound signature verificationWebhook::retry(...)for manual replay- Timestamped SHA-256 HMAC signature header (
t=<ts>,v1=<hmac>) - Queue-driven delivery with configurable retries/backoff
webhook_deliveriestable for observability and replay workflows
Requirements
| Dependency | Version |
|---|---|
| PHP | 8.2+ |
| Laravel | 10-13 |
Installation
Option A: Before Packagist (GitHub VCS)
Use this until the package is published on Packagist.
- Add repository source in your app
composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/snb4crazy/webhook-manager-laravel"
}
]
}
- Require the package from the
masterbranch:
composer require snb4crazy/webhook-manager-laravel:dev-master
Option B: After Packagist (recommended)
Once v0.1.0 is tagged and synced to Packagist:
composer require snb4crazy/webhook-manager-laravel:^0.1
Then run the same setup steps:
- Publish config + migrations and migrate:
php artisan vendor:publish --tag=webhook-manager-config php artisan vendor:publish --tag=webhook-manager-migrations php artisan migrate
- If queue delivery is enabled (default), run a queue worker:
php artisan queue:work
Configuration
Set package options in .env:
WEBHOOK_MANAGER_ENABLED=true WEBHOOK_MANAGER_SECRET=your-shared-secret WEBHOOK_MANAGER_SIGNATURE_HEADER=X-Webhook-Signature WEBHOOK_MANAGER_TIMESTAMP_TOLERANCE=300 WEBHOOK_MANAGER_QUEUE=true WEBHOOK_MANAGER_QUEUE_CONNECTION=database WEBHOOK_MANAGER_QUEUE_NAME=webhooks WEBHOOK_MANAGER_MAX_ATTEMPTS=3 WEBHOOK_MANAGER_CONNECT_TIMEOUT=5 WEBHOOK_MANAGER_TIMEOUT=10 WEBHOOK_MANAGER_LOG_CHANNEL= WEBHOOK_MANAGER_STORE_RESPONSE_BODY=false
Quick start
Send a webhook
use WebhookManager\Laravel\Facades\Webhook; Webhook::send( url: 'https://receiver.example.com/hooks/orders', payload: [ 'event' => 'order.created', 'order_id' => $order->id, 'total' => $order->total, ], options: [ 'event' => 'order.created', 'secret' => config('services.partner.webhook_secret'), 'headers' => ['X-Webhook-Source' => config('app.name')], 'max_attempts' => 5, 'queue' => true, // set false to send synchronously ], );
Verify an incoming webhook
use Illuminate\Http\Request; use WebhookManager\Laravel\Facades\Webhook; public function __invoke(Request $request) { $signature = (string) $request->header('X-Webhook-Signature'); abort_unless( Webhook::verify($request->getContent(), $signature, config('services.partner.webhook_secret')), 401, 'Invalid webhook signature.' ); // Process verified payload... }
Retry a failed delivery
use WebhookManager\Laravel\Facades\Webhook; Webhook::retry($deliveryId); // or Webhook::retry($deliveryModel);
Delivery logs
Each call to Webhook::send() creates/updates a row in webhook_deliveries:
status:pending,delivered,failedattempts,max_attempts,last_attempt_at,delivered_atresponse_status,last_error, optionalresponse_body- stored
payload,headers, and generatedsignature
This table is useful for admin screens, incident investigation, and manual replay tools.
User stories
| Story | How to do it with this package |
|---|---|
| As a SaaS provider, I need to notify customers when an event happens. | Call Webhook::send($url, $payload, ['event' => '...']) from your domain event listener/job. |
| As a receiver, I need to trust only authentic webhook calls. | Validate X-Webhook-Signature with Webhook::verify($rawBody, $signature, $secret). |
| As an operator, I need to recover from transient outages. | Keep queue mode enabled, tune WEBHOOK_MANAGER_MAX_ATTEMPTS, and use Webhook::retry($deliveryId) for manual replay. |
| As a support engineer, I need auditability for deliveries. | Query the webhook_deliveries table for failures, response codes, and attempt history. |
Recommended badges
Already included above:
- License
- Latest release
- PHP support
- Laravel support
- Last commit
Useful additions once available:
- CI status (
github/actions/workflow/status/...) after adding GitHub Actions - Code coverage (Codecov/Coveralls) after publishing coverage reports
- Packagist version/downloads after package publication on Packagist
Testing
composer test
License
MIT