Coder Social home page Coder Social logo

mohamedshuaau / dhiraagu-sms-notification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dash8x/dhiraagu-sms-notification

0.0 0.0 0.0 26 KB

Dhiraagu Bulk SMS Gateway notification channel for Laravel 5.3+

License: MIT License

PHP 100.00%

dhiraagu-sms-notification's Introduction

Dhiraagu Bulk SMS Notification Channel for Laravel 5.3+

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using Dhiraagu Bulk SMS Gateway with Laravel 5.3.

Contents

Installation

You can install the package via composer:

composer require dash8x/dhiraagu-sms-notification

Add the service provider (only required on Laravel 5.4 or lower):

// config/app.php
'providers' => [
    ...
    Dash8x\DhiraaguSmsNotification\DhiraaguSmsNotificationServiceProvider::class,
],

Optionally add the facade.

// 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:

// 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:

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.

public function routeNotificationForDhiraagu()
{
    return '+9607777777';
}

It also supports sending to multiple phone numbers.

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.

Check dash8x/dhiraagu-sms for Delivery Status Checking Documentation.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Disclaimer

This package is not in any way officially affiliated with Dhiraagu. The "Dhiraagu" name has been used under fair use.

dhiraagu-sms-notification's People

Contributors

dash8x avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.