A Laravel package for sending notifications via email, SMS, and push notifications
modulus/laravel-notification is a Laravel package for a laravel package for sending notifications via email, sms, and push notifications.
It currently has 0 GitHub stars and 9 downloads on Packagist.
Install it with composer require modulus/laravel-notification.
Discover more Laravel packages by modulus
or browse all Laravel packages to compare alternatives.
Last updated
A comprehensive Laravel package for sending notifications via Email, SMS (Twilio, Vonage), and push notifications (Firebase Cloud Messaging).
You can install the package via composer:
composer require modulus/laravel-notification
Publish the configuration file:
php artisan vendor:publish --provider="Modulus\Notification\Providers\NotificationServiceProvider" --tag="notification-config"
Optionally, you can publish the views:
php artisan vendor:publish --provider="Modulus\Notification\Providers\NotificationServiceProvider" --tag="notification-views"
Add the following variables to your .env file and set as needed:
# Email Configuration (Using Laravel's mail configuration)
MAIL_FROM_ADDRESS=your-email@example.com
MAIL_FROM_NAME="Your Name"
# SMS Configuration - Twilio
SMS_DRIVER=twilio
TWILIO_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
TWILIO_FROM_NUMBER=your-twilio-phone-number
# SMS Configuration - Vonage
# SMS_DRIVER=vonage
VONAGE_API_KEY=your-vonage-api-key
VONAGE_API_SECRET=your-vonage-api-secret
VONAGE_FROM_NUMBER=your-vonage-phone-number
# Push Notification - Firebase Cloud Messaging
FCM_SERVER_KEY=your-fcm-server-key
use Modulus\Notification\Facades\Notification;
// Basic email
Notification::email(
'[email protected]',
'Welcome!',
'Welcome to our platform',
'https://example.com/path/to/image.jpg', // Optional image
[
'text' => 'Verify Email', // Button text
'url' => 'https://example.com/verify' // Button URL
] // Optional button
);
// Multiple recipients
Notification::email(
['[email protected]', '[email protected]'],
'Team Update',
'Important update for the team',
);
// Custom email template
Notification::emailCustom(
'notification::emails.order-confirmation',
'[email protected]',
'Order Confirmation - #12345',
'Thank you for your order! Here are your order details:',
[
'company_logo' => 'https://yourcompany.com/logo.png',
'company_name' => 'Your Company',
'company_email' => '[email protected]',
'company_phone' => '+1 (555) 123-4567',
'order_url' => 'https://yourcompany.com/orders/12345',
'order' => [
'number' => '12345',
'items' => [
[
'name' => 'Product 1',
'quantity' => 2,
'price' => 29.99
],
[
'name' => 'Product 2',
'quantity' => 1,
'price' => 49.99
]
],
'total' => 109.97,
'shipping_address' => [
'street' => '123 Main St',
'city' => 'New York',
'state' => 'NY',
'zip' => '10001',
'country' => 'United States'
]
]
]
);
use Modulus\Notification\Facades\Notification;
// Send SMS to a single recipient
Notification::sms(
'+1234567890',
'OTP Code',
'Your verification code is: 123456'
);
// Send to multiple recipients
Notification::sms(
['+1234567890', '+0987654321'],
'Sale Alert',
'Our annual sale starts tomorrow! Use code SUMMER20 for 20% off.'
);
use Modulus\Notification\Facades\Notification;
// Send FCM notification to a single device
Notification::realtime(
'fcm-device-token-here',
'New Message',
'You have received a new message from John',
'https://example.com/path/to/image.jpg' // Optional image
);
// Send to multiple devices
Notification::realtime(
['device-token-1', 'device-token-2'],
'Breaking News',
'Check out the latest updates on our platform'
);
resources/views/vendor/notification/emails/Notification::emailCustom(
'notification::emails.your-custom-template',
'[email protected]',
'Email Subject',
'Email Body',
[
// Additional data that will be available in your template
]
);
The MIT License (MIT). Please see License File for more information.