Dhiraagu Bulk SMS Notification Channel for Laravel 5.3+
, (*1)
This package makes it easy to send notifications using Dhiraagu Bulk SMS Gateway with Laravel 5.3., (*2)
Contents
Installation
You can install the package via composer:, (*3)
composer require dash8x/dhiraagu-sms-notification
Add the service provider (only required on Laravel 5.4 or lower):, (*4)
// config/app.php
'providers' => [
...
Dash8x\DhiraaguSmsNotification\DhiraaguSmsNotificationServiceProvider::class,
],
Optionally add the facade., (*5)
// config/app.php
'aliases' => [
...
'DhiraaguSms' => Dash8x\DhiraaguSmsNotification\Facades\DhiraaguSms::class,
],
Setting up the Dhiraagu Bulk Sms Gateway credentials
Add your Dhiraagu Bulk SMS Gateway Account Username, Password, and Url (optional) to your config/services.php
:, (*6)
// config/services.php
...
'dhiraagu' => [
'username' => env('DHIRAAGU_SMS_USERNAME'), // Bulk SMS gateway username, usually same as your sender name
'password' => env('DHIRAAGU_SMS_PASSWORD'), // Bulk SMS gateway password
'url' => env('DHIRAAGU_SMS_URL'), // optional, use only if you need to override the default,
// defaults to https://bulkmessage.dhiraagu.com.mv/partners/xmlMessage.jsp
],
...
Usage
Now you can use the channel in your via()
method inside the notification:, (*7)
use Dash8x\DhiraaguSmsNotification\DhiraaguSmsNotificationChannel;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [DhiraaguSmsNotificationChannel::class];
}
public function toDhiraagu($notifiable)
{
return "Your {$notifiable->service} account was approved!";
}
}
In order to let your Notification know which phone are you sending to, the channel will look for the phone_number attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForDhiraagu method to your Notifiable model., (*8)
public function routeNotificationForDhiraagu()
{
return '+9607777777';
}
It also supports sending to multiple phone numbers., (*9)
public function routeNotificationForDhiraagu()
{
return ['+9607777777', '+9609999999'];
}
Available Message methods
DhiraaguSmsNotificationMessage
-
setNumbers('')
: Accepts phone numbers to use as the notification recipients.
-
setMessage('')
: Accepts a string value for the notification body.
-
getNumbers()
: Returns the recipients.
-
getMessage()
: Returns the string value of the notification body.
Checking delivery status
To proccess any laravel notification channel response check Laravel Notification Events
This channel returns a DhiraaguSmsMessage
response object., (*10)
Check dash8x/dhiraagu-sms for Delivery Status Checking Documentation., (*11)
Changelog
Please see CHANGELOG for more information what has changed recently., (*12)
Testing
bash
$ composer test
, (*13)
Security
If you discover any security related issues, please email arushad@javaabu.com instead of using the issue tracker., (*14)
Contributing
Please see CONTRIBUTING for details., (*15)
Credits
License
The MIT License (MIT). Please see License File for more information., (*16)
Disclaimer
This package is not in any way officially affiliated with Dhiraagu.
The "Dhiraagu" name has been used under fair use., (*17)