jishanhoshen/laravel-notify

Unified notification package for Laravel — SMS, Mail, and Social (Slack/Discord/Telegram) channels with optional per-call queueing.

Maintainers

Package info

github.com/jishanhoshen/laravel-notify

pkg:composer/jishanhoshen/laravel-notify

Transparency log

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-13 10:59 UTC

This package is auto-updated.

Last update: 2026-08-13 11:00:41 UTC


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.

Mail

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 under notify.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.php and map it under notify.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 via Mail::mailer($name)->html(...). If you need a full Mailable (attachments, Markdown templates, etc.), build that in your app and call Mail::mailer($name)->to($to)->send($mailable) directly — this channel is meant for simple notification-style emails.