spatie/laravel-webhook-client
Receive webhooks in your Laravel app with Spatie’s webhook client. Verify signed requests, store incoming payloads, and process them asynchronously via queued jobs. Includes configurable webhook profiles and processing logic for reliable integrations.
webhook_calls table and model aligns with Laravel’s Eloquent ORM, simplifying auditing, retries, and debugging.ProcessWebhookJob) ensures fast HTTP responses (critical for webhook SLAs) while decoupling heavy logic.configs array in webhook-client.php, enabling a single Laravel instance to handle diverse webhook sources.webhook_calls table is opinionated (e.g., created_at, payload, exception). Custom models can extend it, but schema changes may require migrations.exception field on WebhookCall is critical.exception field in WebhookCall suffice for observability?webhook_calls table could feed into dashboards.webhook_calls table. No support for NoSQL.composer require spatie/laravel-webhook-client.php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config" and --tag="webhook-client-migrations"..env with provider-specific secrets (e.g., WEBHOOK_CLIENT_SECRET=stripe_webhook_secret).routes/web.php:
Route::webhooks('stripe/webhooks');
Route::webhooks('github/webhooks');
app/Http/Middleware/VerifyCsrfToken.php.SignatureValidator, WebhookProfile, or ProcessWebhookJob if needed (e.g., for provider-specific logic).namespace App\Jobs;
use Spatie\WebhookClient\Jobs\ProcessWebhookJob;
class StripeWebhookJob extends ProcessWebhookJob {
public function handle() {
$payload = $this->webhookCall->payload;
// Process Stripe events
}
}
config/webhook-client.php to point to custom classes.php artisan migrate.WebhookCall model for custom fields.public function test_stripe_webhook() {
$response = $this->postJson('/stripe/webhooks', $payload, [
'HTTP_Signature' => 'sha256=...',
]);
$response->assertOk();
}
ProcessWebhookJob.ProcessWebhookJob classes.webhook_calls (e.g., failed jobs, latency).webhook_calls table are version-controlled, reducing schema drift risk.webhook_calls table provides a audit trail of all incoming webhooks, including:
webhook_calls table), enabling horizontal scaling of the webhook endpoint. Use a load balancer to distribute traffic.webhook_calls table (e.g., created_at, provider).delete_after_days).webhook_calls storing metadata only.| Failure Scenario | Impact | Mitigation |
|---|
How can I help you explore Laravel packages today?