Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softon/sms
Simple SMS Gateway Package for sending short text messages from your Application. Facade for Laravel 5(Updated to work with Laravel 5.5).Currently supported Gateways Clickatell, MVaayoo, Gupshup, SmsAchariya, SmsCountry, SmsLane, Nexmo, Mocker / Any HTTP/s based Gateways are supported by Custom Gateway. Log gateway can be used for testing.
https://github.com/softon/sms
gupshup laravel-5-package laravel-package laravel55 php sms-api sms-gateway sms-messages
Last synced: 3 days ago
JSON representation
Simple SMS Gateway Package for sending short text messages from your Application. Facade for Laravel 5(Updated to work with Laravel 5.5).Currently supported Gateways Clickatell, MVaayoo, Gupshup, SmsAchariya, SmsCountry, SmsLane, Nexmo, Mocker / Any HTTP/s based Gateways are supported by Custom Gateway. Log gateway can be used for testing.
- Host: GitHub
- URL: https://github.com/softon/sms
- Owner: softon
- License: mit
- Created: 2015-04-17T18:55:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T09:54:00.000Z (about 4 years ago)
- Last Synced: 2024-12-06T04:02:54.545Z (17 days ago)
- Topics: gupshup, laravel-5-package, laravel-package, laravel55, php, sms-api, sms-gateway, sms-messages
- Language: PHP
- Homepage: http://softon.github.io/sms/
- Size: 48.8 KB
- Stars: 46
- Watchers: 6
- Forks: 27
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SMS
Simple SMS(Short Messaging Service) Gateway Package for sending short text messages from your Application. Facade for Laravel 5(Updated to work with Laravel 5.*).Currently supported Gateways Clickatell, MVaayoo, Gupshup, SmsAchariya, SmsCountry, SmsLane, Nexmo, Mocker, MSG91 / Any HTTP/s based Gateways are supported by Custom Gateway. Log gateway can be used for testing.Installation
- Edit the composer.json add to the require array & run composer update
composer require softon/sms
- (Optional for Laravel 5.5+) Add the service provider to the config/app.php file in Laravel
Softon\Sms\SmsServiceProvider::class,
- (Optional for Laravel 5.5) Add an alias for the Facade to the config/app.php file in Laravel
'Sms' => Softon\Sms\Facades\Sms::class,
- Publish the config & views by running
php artisan vendor:publish --provider="Softon\Sms\SmsServiceProvider"
Usage
Edit the config/sms.php. Set the appropriate Gateway and its parameters. Then in your code...
Put your blade template for the SMS in the resources/views/sms folder. Then use the below lines of code to send SMS.
```php
use Softon\Sms\Facades\Sms;
```
Send Single SMS with View:-
```php
// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','sms.test',['param1'=>'Name 1']);
```
Send Single SMS with Raw Message:-
```php
// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','Any Message Text To be sent.');
```
Send Multiple SMS:-
```php
// Params: [Array of MobileNumbers,Blade View Location,SMS Params If Required]
Sms::send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1']);
```
Select the Gateway before sending the Message:-
```php
/*****************************************************
Gateways :: log / clickatell / gupshup / mvaayoo /
smsachariya / smscountry / smslane /
nexmo / msg91 / mocker / custom
*****************************************************/Sms::gateway('mocker')->send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1']);
```With Response:-
```php
// This command gives you the reply recieved from the server.
Sms::send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1'])->response();
```Custom Gateway
Let us suppose you want to use any other gateway. Find the API url with which sms can be sent.
For Example :http://example.com/api/sms.php?uid=737262316a&pin=YOURPIN&sender=your_sender_id&route=0&mobile=8888888888&message=How are You&pushid=1
Then you can setup the Config of Custom Gateway like this:
```php
'custom' => [ // Can be used for any gateway
'url' => '', // Gateway Endpoint
'params' => [ // Parameters to be included in the request
'send_to_name' => 'mobile', // Name of the field of recipient number
'msg_name' => 'message', // Name of the field of Message Text
'others' => [ // Other Authentication params with their values
'uid' => '737262316a',
'pin' => 'YOURPIN',
'sender' => 'your_sender_id',
'route' => '0',
'pushid' => '1',
],
],
'add_code' => true, // Append country code to the mobile numbers
],
```