navraj-sharma/sparrowsms is a Laravel package for sparrow sms notification channel for laravel.
It currently has 0 GitHub stars and 13 downloads on Packagist.
Install it with composer require navraj-sharma/sparrowsms.
Discover more Laravel packages by navraj-sharma
or browse all Laravel packages to compare alternatives.
Last updated
This package makes it easy to send notifications using SparrowSMS with Laravel 5.5+, 6.0 and 7.0
You can install this package via composer:
composer require navraj-sharma/sparrowsms
Add your SparrowSMS configurations to your config/sparrowsms.php:
// config/sparrowsms.php
...
return [
'token' => env('SPARROWSMS_TOKEN'),
'from' => env('SPARROWSMS_FROM'),
'api_endpoint' => env('SPARROWSMS_API_ENDPOINT', 'http://api.sparrowsms.com/v2/'),
'sandbox' => env('SPARROWSMS_SANDBOX', false),
'methods' => [
'send' => 'sms/',
'credit' => 'credit/'
],
'debug' => env('APP_DEBUG', false),
]
...
You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification;
use NavrajSharma\SparrowSMS\SparrowSMSMessage;
class SendSMS extends Notification
{
public function via($notifiable)
{
return ["sparrowsms"];
}
public function toSparrowSMS($notifiable)
{
return (new SparrowSMSMessage("SMS Sent Via SparrowSMS Service"));
}
}
In your notifiable model, make sure to include a routeNotificationForSparrowSMS() method, which returns a phone number or an array of phone numbers.
public function routeNotificationForSparrowSMS()
{
return $this->mobile;
}
Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:
Notification::route('sparrowsms', '9801110000')
->notify(new SendSMS());
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.