PHPackages                             kitbrennan90/laravel-sendgrid-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. [API Development](/categories/api)
4. /
5. kitbrennan90/laravel-sendgrid-webhooks

ActiveLibrary[API Development](/categories/api)

kitbrennan90/laravel-sendgrid-webhooks
======================================

Laravel package for receiving and storing event webhooks from Sendgrid

1.1.1(7y ago)64.0k11[5 issues](https://github.com/kitbrennan90/laravel-sendgrid-webhooks/issues)[1 PRs](https://github.com/kitbrennan90/laravel-sendgrid-webhooks/pulls)MITPHPPHP &gt;=7.0CI failing

Since Apr 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kitbrennan90/laravel-sendgrid-webhooks)[ Packagist](https://packagist.org/packages/kitbrennan90/laravel-sendgrid-webhooks)[ RSS](/packages/kitbrennan90-laravel-sendgrid-webhooks/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

Laravel Sendgrid Webhooks
=========================

[](#laravel-sendgrid-webhooks)

This package enables your Laravel application to receive event webhooks from Sendgrid, and will automatically store those webhooks in your database. The package also fires Laravel events so you can hook in to the webhooks and take your own actions.

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

[](#installation)

### Getting the package

[](#getting-the-package)

The best way to install this package is with composer. Run this from your command line:

```
composer require kitbrennan90/laravel-sendgrid-webhooks ~1.0
```

### Run the migrations

[](#run-the-migrations)

This package will create a table called `sendgrid_webhook_events` which will be used to store all the Sendgrid webhooks received.

Once you have included the package, this migration will run automatically with your normal migrations, so just call:

```
php artisan migrate
```

### Copy the config file (optional)

[](#copy-the-config-file-optional)

This library works without any local configuration, however you may want to use the config file in order to tweak the logs you receive (eg. to receive logs when you receive duplicate events).

Call the command below to copy the package config files:

```
php artisan vendor:publish --provider="LaravelSendgridWebhooks\ServiceProvider"
```

### Tell Sendgrid to use your new event webhook URL

[](#tell-sendgrid-to-use-your-new-event-webhook-url)

Head over to [https://app.sendgrid.com/settings/mail\_settings](https://app.sendgrid.com/settings/mail_settings) and click on the 'Event Notification' section.

Your HTTP Post URL is: `https://yourwebsite.com/sendgrid/webhook`

Using the library
-----------------

[](#using-the-library)

### Querying records

[](#querying-records)

This library uses a standard Laravel Eloquent model, so you can therefore query it as you would any other model.

```
// Include the class
use \LaravelSendgridWebhooks\Models\SendgridWebhookEvent;

////////////////////

// Get all records:
SendgridWebhookEvent::all();

// Get all by message ID:
$sendgridMessageId = 'abc123';
SendgridWebhookEvent::where('sg_message_id', $sendgridMessageId)->all();

// Get all by event ID:
$sendgridEventId = 'xyz987';
SendgridWebhookEvent::where('sg_event_id', $sendgridEventId)->all();

// Get all by event type
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::PROCESSED)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::DEFERRED)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::DELIVERED)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::OPEN)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::CLICK)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::BOUNCE)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::DROPPED)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::SPAMREPORT)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::UNSUBSCRIBE)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::GROUP_UNSUBSCRIBE)->all();
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::GROUP_RESUBSCRIBE)->all();

// Count all bounces
SendgridWebhookEvent::where('event', LaravelSendgridWebhooks\Enums::BOUNCE)->count();
```

### Interacting with a record

[](#interacting-with-a-record)

Accessing data included with all event types:

```
// Get a record
$event = SendgridWebhookEvent::first();

// Included with all event types
$event->timestamp;
$event->email;
$event->event;
$event->categories;
$event->sg_event_id;
$event->sg_message_id;
$event->payload; // Array of full payload sent by Sendgrid
```

Some data is only included with specific events. You can find out what these attributes are here: [https://sendgrid.com/docs/API\_Reference/Event\_Webhook/event.html#-Event-objects](https://sendgrid.com/docs/API_Reference/Event_Webhook/event.html#-Event-objects)

We include this data under the payload array within a record. For example:

```
// Get a record
$event = SendgridWebhookEvent::first();

// Access the reason attribute, included on 'dropped' and 'bounced' events.
$event->payload['reason'];
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance3

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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.

###  Release Activity

Cadence

Every ~9 days

Total

5

Last Release

2599d ago

### Community

Maintainers

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

---

Top Contributors

[![kitbrennan90](https://avatars.githubusercontent.com/u/1593605?v=4)](https://github.com/kitbrennan90 "kitbrennan90 (13 commits)")[![mrobles-cedesa](https://avatars.githubusercontent.com/u/25462594?v=4)](https://github.com/mrobles-cedesa "mrobles-cedesa (1 commits)")[![Orclyx](https://avatars.githubusercontent.com/u/1742238?v=4)](https://github.com/Orclyx "Orclyx (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kitbrennan90-laravel-sendgrid-webhooks/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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