This package makes it easy to send SMS notifications via Muthofun for Laravel 5. Muthofun only provides SMS service for Bangladeshi mobile operators.
You can install the package via composer:
composer require sikhlana/laravel-muthofun-sms-channel
First you must install the service provider (skip for Laravel >= 5.5):
// config/app.php
'providers' => [
...
Sikhlana\MuthofunSmsChannel\ServiceProvider::class,
],
Add your generated Muthofun SMS API key in your .env
file:
...
MUTHOFUN_SMS_USERNAME=
MUTHOFUN_SMS_PASSWORD=
Now you can use the channel in your via()
method inside the notification:
use Sikhlana\MuthofunSmsChannel\MuthofunChannel;
use Sikhlana\MuthofunSmsChannel\MuthofunMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [MuthofunChannel::class];
}
public function toMuthofun($notifiable)
{
return (new MuthofunMessage())
->content("Your {$notifiable->service} account was approved!");
}
}
In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number
attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForMuthofun
method to your Notifiable model.
public function routeNotificationForMuthofun()
{
return '01765432109';
}
content(string)
: Sets the message content.line(string)
: Adds a line of text to the notification.
Please see CHANGELOG for more information what has changed recently.
If you discover any security related issues, please email xoxo@saifmahmud.name instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.