Laravel SendGrid Driver

A Laravel mail driver that sends email through the SendGrid Web API using Laravel's native mail interface.

Library
Composer
v4.0.11
407stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity8
Maintenance0
Community72
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture74
Code Quality72
Innovation80
Learning Curve78

Laravel SendGrid Driver adds a sendgrid mail transport to Laravel and Lumen, letting your application deliver email through SendGrid’s v3 Web API instead of SMTP. It extends Laravel’s own mail classes, so you keep using the standard Mailable API, envelopes, and views while gaining SendGrid-specific features.

Beyond basic sending, the driver exposes SendGrid’s richer payload options — personalizations, categories, dynamic templates, and scheduled delivery — through a simple sendgrid() helper on your Mailables, with a configurable API endpoint for proxying or testing.

What You Get

  • A drop-in sendgrid mail driver for Laravel 9 through 13 and Lumen
  • A SendGrid trait exposing personalizations, categories, templates, and send-at
  • Support for SendGrid dynamic templates via template IDs and template data
  • A configurable custom endpoint for proxying or intercepting API requests
  • Delivery over the SendGrid Web API using Guzzle, avoiding SMTP setup

Common Use Cases

  • Sending transactional email from a Laravel app through SendGrid’s API
  • Tagging outgoing mail with SendGrid categories for analytics and filtering
  • Rendering emails from SendGrid dynamic templates with per-recipient data
  • Scheduling deferred delivery with SendGrid’s send-at parameter

Under The Hood

Architecture - The package registers SendgridTransportServiceProvider, which binds a SendgridTransport into Laravel’s mail manager under the sendgrid scheme. The transport reads the API key and optional endpoint from config/services.php, translates the outgoing message (and any extra fields injected by the SendGrid trait’s sendgrid() helper) into SendGrid’s /v3/mail/send JSON body, and POSTs it via Guzzle. Because it subclasses Laravel’s mail classes, message construction stays inside the framework’s normal pipeline.

Tech Stack - Pure PHP with a small dependency surface: illuminate/mail, illuminate/notifications, and illuminate/support (constrained to Laravel 9-13) plus guzzlehttp/guzzle ^7.2 for HTTP. Dev tooling uses PHPUnit and vlucas/phpdotenv. Autoloading is PSR-4 under the Sichikawa\LaravelSendgridDriver namespace.

Code Quality - The codebase is deliberately small — a service provider, a transport, and a trait — which keeps it easy to audit. A tests/ suite backed by PHPUnit exercises the transport, and the package auto-registers its provider through Laravel’s package discovery extra block.

API Design - Developer experience is a strong point: existing Laravel apps adopt it through configuration alone, and the SendGrid trait provides a single ergonomic sendgrid() method for the API’s advanced fields, so common cases require no new mental model beyond standard Mailables.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search