PHPackages                             puz/laravel-mailgun-webhooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. puz/laravel-mailgun-webhooks

ActiveLibrary[HTTP &amp; Networking](/categories/http)

puz/laravel-mailgun-webhooks
============================

Handle Mailgun webhooks in a Laravel applications

011PHPCI failing

Since Oct 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/molteber/laravel-mailgun-webhooks)[ Packagist](https://packagist.org/packages/puz/laravel-mailgun-webhooks)[ RSS](/packages/puz-laravel-mailgun-webhooks/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Handle Mailgun Webhooks in a Laravel application
================================================

[](#handle-mailgun-webhooks-in-a-laravel-application)

*A clone of [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks)*

[![Latest Version on Packagist](https://camo.githubusercontent.com/3d655a706ee9deb3b80d75c58da45732544a45682d991da55809bff9198f5cd2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70757a2f6c61726176656c2d6d61696c67756e2d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/puz/laravel-mailgun-webhooks)[![Total Downloads](https://camo.githubusercontent.com/8191c9bec3ffa4598bd4087b466daf335f0a93a297c358d38cd70dd8f395119c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70757a2f6c61726176656c2d6d61696c67756e2d776562686f6f6b73732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/puz/laravel-mailgun-webhooks)

[Mailgun](https://mailgun.com) can notify your application of events using webhooks. This package can help you handle those webhooks. Out of the box it will verify the Mailgun signature of all incoming requests. All valid calls will be logged to the database. You can easily define jobs or events that should be dispatched when specific events hit your app.

This package will not handle what should be done after the webhook request has been validated and the right job or event is called. You should still code up any work yourself.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require puz/laravel-mailgun-webhooks
```

The service provider will automatically register itself.

You must publish the config file with:

```
php artisan vendor:publish --provider="Puz\MailgunWebhooks\MailgunWebhooksServiceProvider" --tag="config"
```

In the `webhook_secret` key of the config file you should add a valid webhook secret. You can find the secret used at [the API security settings on the Mailgun dashboard](https://app.mailgun.com/app/account/security/api_keys).

Next, you must publish the migration with:

```
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="migrations"
```

After the migration has been published you can create the `webhook_calls` table by running the migrations:

```
php artisan migrate
```

Finally, take care of the routing: At each domain on your Mailgun account, you must add the callback URL as a webhook for each event you want to listen too. In the routes file of your app you must pass that route to `Route::mailgunWebhooks`:

```
Route::mailgunWebhooks('webhook-route-configured-in-mailgun');
```

Behind the scenes this will register a `POST` route to a controller provided by this package. Because Mailgun has no way of getting a csrf-token, you must add that route to the `except` array of the `VerifyCsrfToken` middleware:

```
protected $except = [
    'webhook-route-configured-in-mailgun',
];
```

Usage
-----

[](#usage)

This package is a complete copy of [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks#usage) and you can read more on how it works over there. There is some great code snippets to see how you can use it

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Spatie: Laravel Stripe Webhooks](https://github.com/spatie/laravel-stripe-webhooks)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2660f1a490c9540df6cf129e8dd1be0704c28192e91970776ec4734642a8fba?d=identicon)[Molteber](/maintainers/Molteber)

---

Top Contributors

[![molteber](https://avatars.githubusercontent.com/u/8125386?v=4)](https://github.com/molteber "molteber (1 commits)")

### Embed Badge

![Health badge](/badges/puz-laravel-mailgun-webhooks/health.svg)

```
[![Health](https://phpackages.com/badges/puz-laravel-mailgun-webhooks/health.svg)](https://phpackages.com/packages/puz-laravel-mailgun-webhooks)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
