dgvai/laravel-notification-channel-onnorokomsms

Laravel Notification Channel Package For OnnorokomSMS BD

1.0.3 2020-06-26 16:25 UTC

This package is auto-updated.

Last update: 2024-04-27 01:08:24 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

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.