laravel-notification-channels / sms-broadcast
SMS Broadcast Notification Channel
Installs: 18 969
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 5
Forks: 2
Open Issues: 1
Requires
- php: >=7.2
- atymic/sms-broadcast: ^1.0
- illuminate/notifications: ~5.6 || ~6.0 || ~7.0
- illuminate/support: ~5.6 || ~6.0 || ~7.0
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-10-18 08:39:00 UTC
README
This package makes it easy to send notifications using Sms Broadcast with Laravel > 5.6 & 6.0.
It uses my Sms Broadcast PHP package under the hood.
Contents
- Installation
- [Setting up the Sms Broadcast service](#setting-up-the-Sms Broadcast-service)
- Usage
- Changelog
- Testing
- Security
- Contributing
- Credits
- License
Installation
Install the package using composer
composer require laravel-notification-channels/sms-broadcast
Add the configuration to your services.php
config file:
'smsbroadcast' => [ 'username' => env('SMS_BROADCAST_USERNAME'), 'password' => env('SMS_BROADCAST_PASSWORD'), 'default_sender' => env('SMS_BROADCAST_DEFAULT_SENDER', null), ]
Usage
You can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification; use NotificationChannels\SmsBroadcast\SmsBroadcastMessage; use NotificationChannels\SmsBroadcast\SmsBroadcastChannel; class AccountApproved extends Notification { public function via($notifiable) { return [SmsBroadcastChannel::class]; } public function toSmsbroadcast($notifiable) { return (new SmsBroadcastMessage) ->content("Task #{$notifiable->id} is complete!"); } }
In your notifiable model, make sure to include a routeNotificationForSmsbroadcast()
method, which returns an australian phone number.
public function routeNotificationForSmsbroadcast() { return $this->phone; // 0412345678 or 6142345678 }
Available methods
sender()
: Sets the sender's name or phone number.
content()
: Set a content of the notification message.
delay()
: Set a delay, in minutes before sending the message
reference()
: Set the SMS ref code
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.