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.
composer require iyngaran/sms-gateway
After install follow one of these steps:
-
Run the command
php artisan vendor:publish
to publish the extension. It will also copy thesms_gateway.php
into the config folder of your laravel application. -
If the
sms_gateway.php
file does not exists in your application config folder, just copy the entire file and place into yourconfig/
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'),
],
];
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.
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'),
],
Use the following code to send SMS.
$objSMS = new SmsGateway(new NexmoSmsGateway());
$response = $objSMS->sendSms('+12012926822','Hello Nexmo');
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.
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'),
]
Use the following code to send SMS.
$objSMST = new SmsGateway(new TwilioSmsGateway());
$response = $objSMST->sendSms('+12012926822','Hello Twilio');
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.
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'),
]
Use the following code to send SMS.
$objSMST = new SmsGateway(new MessageBirdSmsGateway());
$response = $objSMST->sendSms('+12012926822','Hello MessageBird');
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.
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'),
]
Use the following code to send SMS.
$objSMS = new SmsGateway(new DialogSmsGateway());
$response = $objSMS->sendSms('+12012926822','Hello, from Dialog SMS');
You can contribute with this module suggesting improvements, making tests and reporting bugs. Use issues for that.
Report errors opening Issues.