Download the PHP package antiques/laravel-sendgrid-events without Composer
On this page you can find all versions of the php package antiques/laravel-sendgrid-events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antiques/laravel-sendgrid-events
More information about antiques/laravel-sendgrid-events
Files in antiques/laravel-sendgrid-events
Package laravel-sendgrid-events
Short Description Laravel package for receiving, storing and handling events from Sendgrid webhook
License MIT
Informations about the package 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
Getting the package
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:
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:
After that, all events sent by Sendgrid will be automatically stored in the database.
Copy the migrations files (optional)
You are able to configure migrations on your way by running:
Tell Sendgrid to use your new event webhook URL
Head over to 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
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.
Querying records
This library uses a standard Laravel Eloquent model, so you can therefore query it as you would any other model.
Interacting with a record
Accessing data included with all event types:
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
We include this data under the payload array within a record. For example: