PHPackages                             antiques/laravel-sendgrid-events - 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. antiques/laravel-sendgrid-events

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

antiques/laravel-sendgrid-events
================================

Laravel package for receiving, storing and handling events from Sendgrid webhook

1.0(6y ago)24.7k↑66.7%2[1 issues](https://github.com/stefanantic7/laravel-sendgrid-events/issues)MITPHPPHP &gt;=7.0CI failing

Since Jan 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/stefanantic7/laravel-sendgrid-events)[ Packagist](https://packagist.org/packages/antiques/laravel-sendgrid-events)[ RSS](/packages/antiques-laravel-sendgrid-events/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel Sendgrid Events
=======================

[](#laravel-sendgrid-events)

This package enables your Laravel application to receive event webhooks from Sendgrid, and optionaly will store those events 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)

```
composer require antiques/laravel-sendgrid-events
```

### 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 or to enable event storing in the database).

Call the command below to copy the package config files:

```
php artisan vendor:publish --provider="Antiques\LaravelSendgridEvents\ServiceProvider" --tag=config
```

### Run the migrations (optional)

[](#run-the-migrations-optional)

Into config file `sendgridevents.php`, the option that handle storing events `store_events_into_database` is disabled by default and migrations will not run automatically. If `store_events_into_database` is enabled, migrations will be registered and you should run:

```
php artisan migrate
```

After that, all events sent by Sendgrid will be automatically stored in the database.

### Copy the migrations files (optional)

[](#copy-the-migrations-files-optional)

You are able to configure migrations on your way by running:

```
php artisan vendor:publish --provider="Antiques\LaravelSendgridEvents\ServiceProvider" --tag=migrations
```

### 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)

### Listen to events

[](#listen-to-events)

Each time new event is registered the package will trigger `\Antiques\LaravelSendgridEvents\Events\SendgridEventCreated`. Based on that, you could define listeners in your EventServiceProvider and handle further logic.

```
public function handle(SendgridEventCreated $sendgridEventCreated)
{
    $eventType = $sendgridEventCreated->getEventType(); //click, open...

    /**
     * ...
     */

    $sendgridEvent = $sendgridEventCreated->getSendgridEvent();
    $sendgridEvent->email;
    $sendgridEvent->timestamp;

    /**
     * ...
     */
}
```

### 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 \LaravelSendgridEvents\Models\SendgridEvent;

/**
* ...
*/

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

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

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

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

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

### Interacting with a record

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

Accessing data included with all event types:

```
// Get a record
$event = SendgridEvent::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 = SendgridEvent::first();

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2321d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2323b0e446c3a21f449f076b5467c30a1ede56bea120cd618301452a8502afbc?d=identicon)[stefanantic7](/maintainers/stefanantic7)

---

Tags

sendggrid-eventssendgridsendgrid-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antiques-laravel-sendgrid-events/health.svg)

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

###  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)
