dgvai / laravel-notification-channel-onnorokomsms
Laravel Notification Channel Package For OnnorokomSMS BD
Requires
- ext-soap: *
This package is auto-updated.
Last update: 2024-10-27 02:09:38 UTC
README
This package makes it easy to send sms via OnnorokomSMS bulk SMS Service (Bangladesh) with Laravel 5.5+, 6.x and 7.x.
Contents
Installation
You can install the package via composer:
composer require dgvai/laravel-notification-channel-onnorokomsms
Setting up your configuration
Add your OnnorokomSMS Account credentials to your config/services.php
:
// config/services.php ... 'onnorokomsms' => [ 'username' => env('ONNOROKOMSMS_USERNAME'), // The username of OnnorokomSMS service 'password' => env('ONNOROKOMSMS_PASSWORD'), // The password of OnnorokomSMS service 'type' => env('ONNOROKOMSMS_TYPE'), // TEXT or UCS 'mask_name' => env('ONNOROKOMSMS_MASK_NAME'), // optional but not null use '' 'campaign_name' => env('ONNOROKOMSMS_CAMPAIGN_NAME'), // optional but not null use '' ], ...
In order to let your Notification know which phone are you sending to, the channel will look for the mobile_number
attribute of the Notifiable model (eg. User model). If you want to override this behaviour, add the routeNotificationForOnnorokomSMS
method to your Notifiable model.
public function routeNotificationForOnnorokomSMS() { return '+1234567890'; }
Usage
Now you can use the channel in your via()
method inside the notification:
use DGvai\OnnorokomSMS\OnnorokomSMS; use DGvai\OnnorokomSMS\OnnorokomSMSChannel; use Illuminate\Notifications\Notification; class OrderPlaced extends Notification { public function via($notifiable) { return [OnnorokomSMSChannel::class]; } public function toOnnorokomSMS($notifiable) { return new OnnorokomSMS('Your order has been placed!'); } }
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.