maximof/bulk-sms

a wrapper for djunehor/laravel-sms with support for the latest guzzlehttp client and php 7.x


License
MIT

Documentation

Bulk Sms

Bulk SMS allows you to send SMS from your Laravel application using one of the 2 sms providers, or your own sms provider.

Installation

Step 1

You can install the package via composer:

composer require maximof/bulk-sms

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Env Keys

SMS_SENDER=

BULK_SMS_NIGERIA_TOKEN=
BULK_SMS_NIGERIA_DND=

SMART_SMS_TOKEN=

Step 2 - Publishing files

Run: php artisan bulksms:install This will move the config file to the config directory of your app. You can set your sms details in the config file or via the env file

Step 3 - Adding SMS credentials

  • Add the env keys to your .env file
  • Or edit the config/laravel-sms.php file

Usage

//using BulkSmsNigeria
use Maximof\BulkSms\BulkSmsNigeria;

$sms = new BulkSmsNigeria();
$sms->text($message)->to(08054964919)->from('Laravel')->send();
//returns true if everything went fine. Or false if error occured.
//You can get exception via getException() or get the server response via getResponse()
//exceptions will be logged in your laravel log file

Using Helper function

//BulkSMsNigeri
$send = send($message, $to, $from, BulkSmsNigeria::class);
//returns true/false

The default SMS provider is Smart SmsSolution. You can set the default SMS provider in config/bulk-sms.php eg. 'default' => \Maximof\BulkSms\Connectors\BulkSmsNigeria::class,, so you can use the helper function like this:

$send = send($message, $to);
//$from is optional and its better set in the config

Available SMS Providers

Provider URL Tested
BulkSmsNigeria https://www.bulksmsnigeria.com/bulk-sms-api Yes
SmartSmsSolutions https://docs.smartsmssolutions.com/docs/send-with-basic-route Yes

Creating custom SMS Provider

  • Create a class that extends Maximof\BulkSms\Connectors\Sms class
  • Implement the send() which makes the request and return bool
  • (Optional) You can add the provider keys to the config/bulk-sms.php

Contributing

  • Fork this project
  • Clone to your repo
  • Make your changes and run tests composer test
  • Push and create Pull request