Handle Webhooks in Laravel with Receiver
Published on by Paul Redmond
Laravel Receiver is a drop-in webhook handling library for Laravel. It makes handling incoming webhooks easy, with built-in support for:
The built-in providers are also secured using each provider's prescribed verification method (i.e., signatures). This package takes the pain out of the setup and boilerplate about handling the request, letting you focus on the code for handling webhooks.
Receiver also makes it easy to define custom providers that work with webhooks from any source. Once you specify webhook providers, you can handle them using conventions provided by the package in handler classes which you can also send to a Laravel queue for processing.
The Receiver package takes care of the controller code, so the heart of your integration with this package would be within handlers. Here's an example handler from the readme for Stripe's customer.created
webhook:
namespace App\Http\Handlers\Stripe; class CustomerCreated{ public function __construct(public string $event, public array $data) { } public function handle() { // Your code here }}
You can learn more about this package, get full installation instructions, and view the source code on GitHub.