senderkit/senderkit-laravel integrates the
PHP SDK core with Laravel’s notification system, mail
infrastructure, and HTTP routing.
Install
.env:
SenderKit\Client directly from the container, or use the
SenderKit facade:
Notification channel
Thesenderkit channel delivers template-based notifications across all four
channels (email, SMS, push, web push). It is the recommended path for new
code — templates are versioned, previewable in the dashboard, and carry
per-template analytics.
Return a SenderKitMessage from toSenderKit(). For email notifications the
recipient resolves from the notifiable’s senderkit route, falling back to
the mail route — so a User model with an email property works without
any extra setup:
SenderKitMessage supports the full set of send options:
| Method | Description |
|---|---|
->vars(array $vars) | Template variables |
->channel(Channel $channel) | Force a channel (see below) |
->version(int $version) | Pin a template version |
->metadata(array $metadata) | Attach metadata to the message |
->scheduledAt(\DateTimeInterface|string $at) | Defer delivery |
->cc(array $addresses) | Cc (email only) |
->bcc(array $addresses) | Bcc (email only) |
->replyTo(string $address) | Reply-To (email only) |
->attachments(array $attachments) | Attachments (email only) |
->idempotencyKey(string $key) | Explicit idempotency key |
->to(string $recipient) | Override the resolved recipient |
SMS, push, and web push
Email notifications fall back to the notifiable’smail route automatically.
For other channels, expose a routeNotificationForSenderkit() method that
returns either a string (used for all channels) or a channel-keyed map:
->to() is set. Only email falls back to the mail route.
Fan-out across channels
toSenderKit() can return an array of SenderKitMessage objects to dispatch
the notification on multiple channels in a single call:
Mail transport
Thesenderkit mail driver routes an existing Mailable-based app through
SenderKit without code changes — no need to rewrite Mail::to(...)->send(...)
calls, queued mail jobs, or mail-channel notifications.
Add a mailer entry to config/mail.php:
MAIL_MAILER=senderkit. All outgoing mail now delivers through
SenderKit.
The transport renders your Mailable to HTML locally, then uses a raw
send — bypassing SenderKit templates. You lose versioning, dashboard
preview, and per-template analytics. The mail transport is the right path
for migrating existing Mailable-based code. For new notifications,
prefer the
senderkit notification channel above.- Text-only emails — the transport generates an escaped-HTML fallback automatically (the API requires an HTML body).
- Multiple
torecipients — fanned out as one API call per recipient.
Webhooks
TheVerifyWebhookSignature middleware verifies the incoming request
signature and attaches the parsed event to $request->attributes.
- Invalid signatures →
400 - Missing
senderkit.webhook_secretconfig →500
PHP SDK core
Client API, error handling, and bare-PHP webhook verifier.
Symfony
Bundle autowiring and Symfony webhook verifier.
Webhooks
Event types and payload schema.
Authentication
API keys, scopes, and test vs. live mode.