PHP Classes

Laravel PHP SMS API Integration: Abstraction to send SMS messages via multiple APIs

Recommend this page to a friend!
  Info   View files Documentation   View files View files (29)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 71 This week: 1All time: 10,229 This week: 560Up
Version License PHP version Categories
laravel-sms 1.0.0Custom (specified...5PHP 5, Wireless and Mobile, Web services
Description 

Author

This package provides an abstraction to send SMS messages via multiple APIs.

It provides an abstract class that offers a fluent interface to perform common steps for sending a SMS message like setting the message text, sender and recipient numbers.

Then there are concrete classes that extende the abstract base class to provide implementations by accessing the APIs of different providers. Currently the package provides implementation classes for:

- AfricasTalking
- BetaSms
- BulkSmsNigeria
- GoldSms247
- InfoBip
- KudiSms
- MeboSms
- MultiTexter
- Nexmo
- NigerianBulkSms
- RingCaptcha
- SmartSmsSolutions
- SmsLive247
- XWirelesS

Picture of Zacchaeus Bolaji
  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 15 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 250415 in Nigeria Nigeria
Week rank: 411 Up10 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 10x

Documentation

Laravel SMS

CircleCI Latest Stable Version Total Downloads License StyleCI Build Status Scrutinizer Code Quality Code Coverage

Laravel SMS allows you to send SMS from your Laravel application using one of over 10 sms providers, or your own sms provider.

Installation

Step 1

You can install the package via composer:

composer require djunehor/laravel-sms

Laravel 5.5 and above

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

Laravel 5.4 and older

In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:

'providers' => [
    // ...
    Djunehor\Sms\SmsServiceProvider::class,
];

Lumen

After installing the package, you will have to register it in bootstrap/app.php file manually:

// Register Service Providers
    // ...
    $app->register(Djunehor\Sms\SmsServiceProvider::class);
];

Env Keys

SMS_SENDER=

BETASMS_USERNAME=
BETASMS_PASSWORD=

BULK_SMS_NIGERIA_TOKEN=
BULK_SMS_NIGERIA_DND=

GOLD_SMS_247_USERNAME=
GOLD_SMS_247_PASSWORD=

MULTITEXTER_USERNAME=
MULTITEXTER_PASSWORD=

SMART_SMS_TOKEN=

XWIRELESS_API_KEY=
XWIRELESS_CLIENT_ID=

NEXMO_API_KEY=
NEXMO_API_SECRET=

RING_CAPTCHA_APP_KEY=
RING_CAPTCHA_API_KEY=
RING_CAPTCHA_APP_SECRET=

AFRICASTALKING_API_KEY=
AFRICASTALKING_USERNAME=

NIGERIAN_BULK_SMS_USERNAME=
NIGERIAN_BULK_SMS_PASSWORD=

KUDI_SMS_USERNAME=
KUDI_SMS_PASSWORD=

MEBO_SMS_API_KEY=

SMSLIVE247_TOKEN=

INFOBIP_BASE_URL=
INFOBIP_USERNAME=
INFOBIP_PASSWORD=

Step 2 - Publishing files

Run: php artisan vendor:publish --tag=laravel-sms This will move the migration file, seeder file and config file to your app. You can set your sms details in the config file or via env

Step 3 - Adding SMS credentials

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

Usage

//using betaSMS
use Djunehor\Sms\BetaSms;`

$sms = new BetaSms();
$sms->text($message)->to(08135087966)->from('MyLaravel')->send();

Using Helper function

//MeboSms
$send = send_sms($message, $to, $from, MeboSms::class);

The default SMS provider is Nexmo. You can set the default SMS provider in config/laravel-sms.php e.g 'default' => \Djunehor\Sms\Concrete\SmartSmsSolutions::class,, so you can use the helper function like this:

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

Available SMS Providers

|Provider|URL|Tested| |:--------- | :-----------------: | :------: | |Nexmo|https://developer.nexmo.com/api/sms#send-an-sms|Yes| |AfricasTalking|https://build.at-labs.io/docs/sms%2Fsending|Yes|| |BetaSms|https://login.betasms.com.ng/|Yes| |MultiTexter|https://web.multitexter.com/MultiTexter_HTTP_SMS_API%202.0.pdf|Yes| |BulkSmsNigeria|https://www.bulksmsnigeria.com/bulk-sms-api|Yes| |GoldSms247|https://goldsms247.com/index.php/api|Yes| |KudiSms|https://kudisms.net/api/|Yes| |Mebosms|http://mebosms.com/api-sms|Yes| |NigerianBulkSms|https://nigeriabulksms.com/sms-gateway-api/|Yes| |SmartSmsSolutions|https://docs.smartsmssolutions.com/docs/send-with-basic-route|Yes| |RingCaptcha|https://my.ringcaptcha.com/docs/api|No| |SmsLive247|http://portal.smslive247.com/developer_api/http.aspx|No| |XWireless|https://xwireless.net/cportal/knowledge-base/article/sms-3|No| |InfoBip|https://dev.infobip.com/send-sms/single-sms-message|No|

Creating custom SMS Provider

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

Contributing

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

  Files folder image Files  
File Role Description
Files folder image.circleci (1 file)
Files folder imagesrc (1 file, 4 directories)
Files folder imagetests (3 files)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageConcrete (15 files)
Files folder imageconfig (1 file)
Files folder imageContract (1 file)
Files folder imageHelpers (1 file)
  Plain text file SmsServiceProvider.php Class Class source

  Files folder image Files  /  src  /  Concrete  
File Role Description
  Plain text file AfricasTalking.php Class Class source
  Plain text file BetaSms.php Class Class source
  Plain text file BulkSmsNigeria.php Class Class source
  Plain text file GoldSms247.php Class Class source
  Plain text file InfoBip.php Class Class source
  Plain text file KudiSms.php Class Class source
  Plain text file MeboSms.php Class Class source
  Plain text file MultiTexter.php Class Class source
  Plain text file Nexmo.php Class Class source
  Plain text file NigerianBulkSms.php Class Class source
  Plain text file RingCaptcha.php Class Class source
  Plain text file SmartSmsSolutions.php Class Class source
  Plain text file Sms.php Class Class source
  Plain text file SmsLive247.php Class Class source
  Plain text file XWireless.php Class Class source

  Files folder image Files  /  src  /  config  
File Role Description
  Plain text file laravel-sms.php Class Class source

  Files folder image Files  /  src  /  Contract  
File Role Description
  Plain text file SmsServiceInterface.php Class Class source

  Files folder image Files  /  src  /  Helpers  
File Role Description
  Accessible without login Plain text file helpers.php Example Example script

  Files folder image Files  /  tests  
File Role Description
  Plain text file SmsHelperTest.php Class Class source
  Plain text file SmsTest.php Class Class source
  Plain text file TestCase.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:1
All time:10,229
This week:560Up