iyngaran/sms-gateway

It is a Laravel package which will serve as gateway to send SMS through various providers. It supports multiple sms gateways, and easily extendable to support new gateways.

1.0.6 2019-04-02 06:16 UTC

This package is not auto-updated.

Last update: 2021-11-24 00:51:55 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

It is a Laravel package which will serve as gateway to send SMS through various providers. It supports multiple sms gateways, and easily extendable to support new gateways.

INSTALLING

composer require iyngaran/sms-gateway

After install follow one of these steps:

  1. Run the command php artisan vendor:publish to publish the extension. It will also copy the sms_gateway.php into the config folder of your laravel application.

  2. If the sms_gateway.php file does not exists in your application config folder, just copy the entire file and place into your config/ folder.

Then add your NEXMO_API_KEY,NEXMO_API_SECRET and NEXMO_SMS_FROM Key. To get your API Key, please visit

// config/sms_gateway.php

return [
    'nexmo_sms_api_settings' => [
        'API_KEY' => env('NEXMO_API_KEY', ''),
        'API_SECRET' => env('NEXMO_API_SECRET', ''),
        'SEND_SMS_FROM' => env('NEXMO_SMS_FROM', 'IYNGARAN'),
    ],
    'twilio_sms_api_settings' => [
        'SID' => env('TWILIO_SID', ''),
        'TOKEN' => env('TWILIO_TOKEN', ''),
        'SEND_SMS_FROM' => env('TWILIO_SMS_FROM', '+12012926824'),
    ],
    'message_bird_sms_api_settings' => [
        'API_KEY' => env('MESSAGE_BIRD_API_KEY', ''),
        'SEND_SMS_FROM' => env('MESSAGE_BIRD_SMS_FROM', '+12012926824'),
    ],
    'dialog_sms_api_settings' => [
         'API_KEY' => env('DIALOG_SMS_API_KEY', ''),
         'ENDPOINT' => env('DIALOG_SMS_ENDPOINT', ''),
         'SEND_SMS_FROM' => env('DIALOG_SMS_FROM', 'IYNGARAN'),
    ],
];

USAGE

68747470733a2f2f7777772e6e65786d6f2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30362f6e65786d6f2d6c6f676f2d6c672e6a7067

Nexmo

Nexmo provides innovative communication SMS and Voice APIs that enable applications and enterprises to easily connect to their customers.

Website : www.nexmo.com

Developer Documentation: developer.nexmo.com

To send sms using Nexmo API, you need to get the API KEY and API SECRET from Nexmo.

When initially subscribing to Nexmo 2 EUR free test credit is granted for testing your application.

Nexmo Configuration

Open the config file config/sms_gateway.php and add your API KEY and API SECRET to the following section of the configuration file.

'nexmo_sms_api_settings' => [
        'API_KEY' => env('NEXMO_API_KEY', ''),
        'API_SECRET' => env('NEXMO_API_SECRET', ''),
        'SEND_SMS_FROM' => env('NEXMO_SMS_FROM', 'IYNGARAN'),
],

Sending SMS - Nexmo

Use the following code to send SMS.

    $objSMS = new SmsGateway(new NexmoSmsGateway());
    $response = $objSMS->sendSms('+12012926822','Hello Nexmo');
68747470733a2f2f7777772e7477696c696f2e636f6d2f6d61726b6574696e672f62756e646c65732f636f6d70616e792f696d672f6c6f676f732f7265642f7477696c696f2d6c6f676f2d7265642e737667

Twilio

Twilio allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs.

Website : twilio.com

Developer Documentation: Twilio API

To send sms using Twilio API, you need to get the SID and TOKEN from Twilio.

When initially subscribing to Twilio $15.50 free test credit is granted for testing your application.

Twilio Configuration

Open the config file config/sms_gateway.php and add your SID and TOKEN to the following section of the configuration file.

twilio_sms_api_settings' => [
        'SID' => env('TWILIO_SID', ''),
        'TOKEN' => env('TWILIO_TOKEN', ''),
        'SEND_SMS_FROM' => env('TWILIO_SMS_FROM', '+12012926824'),
]

Sending SMS - Twilio

Use the following code to send SMS.

    $objSMST = new SmsGateway(new TwilioSmsGateway());
    $response = $objSMST->sendSms('+12012926822','Hello Twilio');
68747470733a2f2f7777772e6d657373616765626972642e636f6d2f696d672f6c6f676f2e737667

MessageBird

MessageBird is a powerful communication APIs and technical resources to help you build your communication solution.

Website : messagebird.com

Developer Documentation: developers.messagebird.com

To send sms using MessageBird API, you need to get the API KEY from MessageBird.

When initially subscribing to MessageBird 10 free SMS credit is granted for testing your application on live.

MessageBird Configuration

Open the config file config/sms_gateway.php and add your API_KEY to the following section of the configuration file.

'message_bird_sms_api_settings' => [
        'API_KEY' => env('MESSAGE_BIRD_API_KEY', ''),
        'SEND_SMS_FROM' => env('MESSAGE_BIRD_SMS_FROM', '+12012926824'),
 ]

Sending SMS - MessageBird

Use the following code to send SMS.

    $objSMST = new SmsGateway(new MessageBirdSmsGateway());
    $response = $objSMST->sendSms('+12012926822','Hello MessageBird');
68747470733a2f2f7777772e6469616c6f672e6c6b2f6469616c6f67646f63726f6f742f636f6e74656e742f696d616765732f6469616c6f675f6c6f676f4032782e706e67

Dialog (Sri Lanka)

Dialog Axiata PLC has hence combined its innovativeness and technical superiority to bring out a solution that will enable you to tap into this opportunity by introducing Dialog Bulk SMS Solution which will enable you to communicate by SMS to a mass list of customers/staff through an easy to use web portal that can also be accessed from any location.

Website : dialog.lk

To send sms using Dialog SMS API, you need to get the API KEY from Dialog.

Dialog Configuration

Open the config file config/sms_gateway.php and add your API_KEY to the following section of the configuration file.

'dialog_sms_api_settings' => [
        'API_KEY' => env('DIALOG_SMS_API_KEY', ''),
        'ENDPOINT' => env('DIALOG_SMS_ENDPOINT', ''),
        'SEND_SMS_FROM' => env('DIALOG_SMS_FROM', 'IYNGARAN'),
    ]

Sending SMS - Dialog

Use the following code to send SMS.

    $objSMS = new SmsGateway(new DialogSmsGateway());
    $response = $objSMS->sendSms('+12012926822','Hello, from Dialog SMS');

CONTRIBUTING

You can contribute with this module suggesting improvements, making tests and reporting bugs. Use issues for that.

ERRORS

Report errors opening Issues.