Giter Site home page Giter Site logo

likeashraful / laravel-bulk-sms-bd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nanopkg/laravel-bulk-sms-bd

0.0 0.0 0.0 39 KB

With this package you can easily integrate bulk sms system in your project with bulksmsbd.com API of Bangladesh.

Home Page: https://github.com/nanopkg/laravel-bulk-sms-bd

License: MIT License

PHP 100.00%

laravel-bulk-sms-bd's Introduction

laravel-bulk-sms-bd

With this package you can easily integrate bulk sms system in your project with bulksmsbd.com API of Bangladesh.

Latest Version on Packagist Issues GitHub Tests Action Status Total Downloads License

Installation

You can install the package via composer:

composer require nanopkg/laravel-bulk-sms-bd

You can publish the config file with:

php artisan vendor:publish --tag="bulk-sms-bd-config"

This is the contents of the published config file:

return [
     /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Mode of sending sms
    |--------------------------------------------------------------------------
    |
    | This value is the mode of your laravel-bulk-sms-bd api integration.
    | log: for testing purpose
    | live: for live sms sending
    |
    */
    'mode' => env('BULK_SMS_BD_MODE', 'log'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Key
    |--------------------------------------------------------------------------
    |
    | This value is the api key of your laravel-bulk-sms-bd api integration.
    |
    */

    'api_key' => env('BULK_SMS_BD_API_KEY', ''),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Sender ID
    |--------------------------------------------------------------------------
    |
    | This value is the Sender ID of your laravel-bulk-sms-bd api integration.
    |
    */

    'sender_id' => env('BULK_SMS_BD_SENDER_ID', ''),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Url
    |--------------------------------------------------------------------------
    |
    | This value is the Api Url of your laravel-bulk-sms-bd api integration.
    |
    */

    'base_uri' => env('BULK_SMS_BD_API_URL', 'https://bulksmsbd.net/api/'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD Api Url SSL VERIFY
    |--------------------------------------------------------------------------
    |
    | This value is the Api Url SSL verify of your laravel-bulk-sms-bd api integration.
    |
    */

    'verify' => env('BULK_SMS_BD_API_URL_VERIFY', false),

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Log
    |--------------------------------------------------------------------------
    |
    | This value is the log  of your laravel-bulk-sms-bd api integration.
    |
    */
    'log' => [
        'driver' => env('BULK_SMS_BD_LOG_DRIVER', 'single'),
        'path' => env('BULK_SMS_BD_LOG_PATH', storage_path('logs/laravel-bulk-sms-bd-log.log')),
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel Bulk SMS BD  Notification Keys
    |--------------------------------------------------------------------------
    |
    | This value is the Notification Keys of your laravel-bulk-sms-bd api integration.
    |
    */
    'notification' => [
        // define your custom notification key for  message
        'message' => 'message',
        // define your custom notification key for mobile number
        'contacts' => 'to',
    ],
];

Add the following items to your .env file

// This value is the mode of your laravel-bulk-sms-bd api integration. | log: for testing purpose | live: for live sms sending
BULK_SMS_BD_MODE='log'

// This value is the api key of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_API_KEY=''

// This value is the Sender ID of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_SENDER_ID=''

// This value is the Api Url SSL verify of your laravel-bulk-sms-bd api integration.
BULK_SMS_BD_API_URL_VERIFY=false

Usage


Get SMS Gateway Balance

Follow the below steps to get sms gateway balance

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

// get gateway balance
$response = BulkSmsBd::getBalance();
return $response->balance;

Send One To One SMS

Follow the below steps to send one to one sms

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

// send one to one sms
BulkSmsBd::oneToOne('017xxxxxxxx', 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।')->send();

If you want to send SMS by queue then follow below steps instead of above method.

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdOneToOne;

// send one to one sms
BulkSmsBdOneToOne::dispatch('017xxxxxxxx', 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।');

Send One To Many SMS

Follow the below steps to send one to Many sms

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

//  Send one to many sms
BulkSmsBd::oneToMany(['017xxxxxxxx','018xxxxxxxx','019xxxxxxxx'], 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।')->send();

If you want to send SMS by queue then follow below steps instead of above method.

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdOneToMany;

//  Send one to many sms
BulkSmsBdOneToMany::dispatch(['017xxxxxxxx','018xxxxxxxx','019xxxxxxxx'], 'আমার সোনার বাংলা, আমি তোমার ভালোবাসি।');

Send Many To Many SMS

Follow the below steps to send Many to Many sms

use Nanopkg\BulkSmsBd\Facades\BulkSmsBd;

//  Send one to many sms
BulkSmsBd::manyToMany([
    [
        'to' => '017xxxxxxxx',
        'message' => 'আমার সোনার বাংলা।'
    ],
    [
        'to' => '018xxxxxxxx',
        'message' => 'আমি তোমার ভালোবাসি।'
    ],
])->send();

If you want to send SMS Many to Many by queue then follow below steps instead of above method.

use Nanopkg\BulkSmsBd\Jobs\BulkSmsBdManyToMany;

//  Send one to many sms
BulkSmsBdManyToMany::dispatch([
     [
        'to' => '017xxxxxxxx',
        'message' => 'আমার সোনার বাংলা।'
    ],
    [
        'to' => '018xxxxxxxx',
        'message' => 'আমি তোমার ভালোবাসি।'
    ]
]);

Send SMS Via Notification

Follow the below steps to send Many to Many sms

use Nanopkg\BulkSmsBd\Broadcasting\BulkSmsBdChannel;

/**
* Get the notification's delivery channels.
*
* @param  mixed  $notifiable
* @return array
*/
public function via($notifiable)
{
    return [BulkSmsBdChannel::class];
}


/**
* Get the BulkSmsBd representation of the notification.
* @param  mixed  $notifiable
* @return array
*/
public function toBulkSmsBd($notifiable)
{
    return [
        'message' => 'আমার সোনার বাংলা, আমি তোমায় ভালোবাসি',
        'to' => $notifiable->phone,
    ];
}

If you want to customize Notification representation key then open bulksmsbd config file and modify notification message and contacts value.

'notification' => [
    // define your custom notification key for  message
    'message' => 'message',
    // define your custom notification key for mobile number
    'contacts' => 'to',
],

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

laravel-bulk-sms-bd's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar iqbalhasandev avatar likeashraful 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.