jishanhoshen / laravel-notify
Unified notification package for Laravel — SMS, Mail, and Social (Slack/Discord/Telegram) channels with optional per-call queueing.
Requires
- php: ^8.1
- illuminate/http: ^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/mail: ^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/queue: ^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0|^13.0
- jishanhoshen/laravel-sms: @dev
README
Unified notification package for Laravel: SMS, Mail, and Social (Slack/Discord/Telegram) behind one consistent, fluent API — with optional per-call queueing.
Depends on jishanhoshen/laravel-sms for the SMS channel (no duplicated code).
Install
Requires jishanhoshen/laravel-sms too — register both as path/VCS repositories in the
consuming app's composer.json:
"repositories": [ { "type": "path", "url": "../packages/laravel-sms" }, { "type": "path", "url": "../packages/laravel-notify" } ]
composer require jishanhoshen/laravel-notify:@dev
Publish config:
php artisan vendor:publish --tag=notify-config php artisan vendor:publish --tag=sms-config
Setup
SMS
Configured entirely through jishanhoshen/laravel-sms's own .env keys
(SMS_PROVIDER, SHIRAMSYSTEM_*, TWILIO_*, etc — see that package's README).
NOTIFY_SMS_PROVIDER optionally overrides which provider laravel-notify defaults to.
This package does not store SMTP credentials. Add named mailers to your app's own
config/mail.php mailers array (e.g. gmail, business), then point to them:
NOTIFY_MAIL_MAILER=gmail
NOTIFY_MAIL_GMAIL_MAILER=gmail
NOTIFY_MAIL_BUSINESS_MAILER=business
Social
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
TELEGRAM_BOT_TOKEN=123456:ABC-your-bot-token
TELEGRAM_CHAT_ID=123456789
NOTIFY_SOCIAL_DRIVER=slack
Queue
NOTIFY_QUEUE_BY_DEFAULT=false
NOTIFY_QUEUE_CONNECTION=redis
NOTIFY_QUEUE_NAME=notifications
queue_by_default only matters when a call doesn't explicitly say ->queue() or ->now() —
either of those always wins.
Usage
use JishanHoshen\LaravelNotify\Facades\Notifier; // SMS Notifier::sms()->send('01712345678', 'Your OTP is 1234'); // default provider Notifier::sms()->via('twilio')->send('01712345678', 'Your OTP is 1234'); Notifier::sms()->via('shiramsystem')->queue()->send('01712345678', 'Hello'); // queued // Mail Notifier::mail()->send('user@example.com', 'Welcome', '<p>Hello!</p>'); Notifier::mail()->via('business')->queue('emails')->send('user@example.com', 'Invoice', '<p>...</p>'); // Social Notifier::social()->send(null, 'Deploy finished ✅'); // default driver (slack) Notifier::social()->via('discord')->send(null, 'Build failed ❌'); Notifier::social()->via('telegram')->send('987654321', 'Alert: disk 90% full'); // chat_id override
->queue() dispatches a ShouldQueue job on the configured connection/queue and returns
null immediately. ->now() (or leaving both off with queue_by_default=false) runs inline
and returns the real bool result.
Adding a channel/driver
- New SMS provider — add it to
jishanhoshen/laravel-sms(see that package's README). - New social driver — implement
JishanHoshen\LaravelNotify\Social\SocialDriverInterface, add its config undernotify.social.drivers, then register it:Notifier::social()->extend('mattermost', \App\Notify\MattermostDriver::class);
- New mail "identity" — just add another named mailer in your app's
config/mail.phpand map it undernotify.mail.mailers.
Notes
- Slack/Discord webhook and Telegram Bot API integrations here call the providers' REST endpoints directly — verify against current docs before production use.
MailChannel::send()sends a raw HTML body viaMail::mailer($name)->html(...). If you need a full Mailable (attachments, Markdown templates, etc.), build that in your app and callMail::mailer($name)->to($to)->send($mailable)directly — this channel is meant for simple notification-style emails.