Description
Receive webhooks in Laravel apps
At the app that sends webhooks, you probably configure an URL where you want your webhook requests to be sent. In the routes file of your app, you must pass that route to Route::webhooks. Here's an example:
Route::webhooks('webhook-receiving-url');
Behind the scenes, by default this will register a POST route to a controller provided by this package. Because the app that sends webhooks to you has no way of getting a csrf-token, you must exclude the route from csrf token validation.
Here is how you can do that in recent versions of Laravel.
use Illuminate\Foundation\Application;use Illuminate\Foundation\Configuration\Middleware; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( // ... ) ->withMiddleware(function (Middleware $middleware) { $middleware->validateCsrfTokens(except: [ 'your-webhook-receiving-url' ]); })->create();
Recent Courses on Laravel Daily
AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)
7 lessons
52 min
Laravel 13 Eloquent: Expert Level
41 lessons
1 h 34 min
How to Build Laravel 13 API From Scratch
30 lessons
1 h 23 min