Giter VIP home page Giter VIP logo

softon / sms Goto Github PK

View Code? Open in Web Editor NEW
45.0 6.0 27.0 50 KB

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.

Home Page: http://softon.github.io/sms/

License: MIT License

PHP 99.83% Blade 0.17%
laravel-5-package laravel55 laravel-package sms-gateway sms-api sms-messages php gupshup

sms's Introduction

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

  1. Edit the composer.json add to the require array & run composer update
     composer require softon/sms 
  2. (Optional for Laravel 5.5+) Add the service provider to the config/app.php file in Laravel
     Softon\Sms\SmsServiceProvider::class, 
  3. (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, 
  4. 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.

use Softon\Sms\Facades\Sms;  

Send Single SMS with View:-

// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','sms.test',['param1'=>'Name 1']);  

Send Single SMS with Raw Message:-

// Params: [MobileNumber,Blade View Location,SMS Params If Required]
Sms::send('9090909090','Any Message Text To be sent.');  

Send Multiple SMS:-

// 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:-

/*****************************************************
 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:-

// 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:

        '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
        ],

sms's People

Contributors

azorpax avatar itsmejithin avatar softon avatar tiipiik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sms's Issues

Laravel 5.5 Support ???

I am getting error when using it in Laravel 5.5 same code worked perfectly on 5.2

Target [Softon\Sms\Gateways\SmsGatewayInterface] is not instantiable while building [\Softon\Sms\Sms].

Not able to send SMS via custom gateway

This is my code and configuration, im not able to send SMS via custom gateway.
where i am wrong.
"softon/sms": "2.0.2",

config/sms.php

'bhas' => [ // Can be used for any gateway 'url' => 'http://mysms.clickerstudio.in/api/sendmsg.php?', // 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 'user' => 'myusername', 'pass' => 'dsjofkjh', 'sender' => 'TECARE', 'priority' => 'ndnd', 'stype' => 'normal', ], ], 'add_code' => false, // Append country code to the mobile numbers ],

Laravel 7.x support

I tried upgrading my Laravel to ^7.0 . But, am getting the following errors:

  • softon/sms v2.0.3 requires illuminate/support ~5.0|~6.0 -> satisfiable by laravel/framework[v6.18.0], illuminate/support[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, 6.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].

Based on the Laravel 7.x upgrade guide here: https://laravel.com/docs/7.x/upgrade

I don't see any issues in allowing 7.x version of Laravel. Please allow the same.

Response not implemented

When using Clickatell and the response method:

Sms::send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1'])->response(); 

I got an error Reponse method not implemented.

ERR: 108, Invalid or missing api_id

Dear Softon Author,

I'm using Clickatell. I'm sure i have used the correct API Key but I still get this error response:
"ERR: 108, Invalid or missing api_id"

What is actually the api_id, isn't it the API Key that generate under SMS Integration menu?
Thanks.

capture

how to call clickatell SMS API using softon

i new in clickatell. so, i dont know how to send message using clickatell SMS API.
i follow hole step but i don't know which file i put this line:
//Gateways :: Log / Clickatell / Gupshup / MVaayoo / SmsAchariya / SmsCountry / SmsLane / Custom
Sms::gateway('NameOfGateway')->send(['87686655455','1212121212','2323232323'],'sms.test',['param1'=>'Name 1']);

and also in which parameter pass on this array ['param1'=>'Name 1']

Specify custom gateway for sending SMS

Hi!
Pretty nice package, but for me at a glance it lacks opportunity to specify my own custom gateway for sending SMS.
This could be achieved in two ways from user-side:

  1. Specify Gateway class directly in config. In this case the package core should check, whether specified value in config is of predefined gateways (it should have an internal array of supported gateways out of the box and just check whether supplied gateway string is in this array). The problem here is how to specify gateway's credentials.
  2. Have a public Facade method which should be called prior to sending SMS, somthing like this:
$gw = new \App\Sms\MyCustomGateway("my_user_id", "my_secret");
Sms::setGateway($gw);
Sms::send("Code: 4356", "79111234567");

Hope you'll find this issue useful and implement as soon as you have time :)

Good luck and Regards,
Amegatron.

How to send SMS instead of Template?

Hi,
This utilizes blade view templates to send SMS. ie.

// Params: [MobileNumber,Blade View Location,SMS Params If Required] 

but how to send sms using HTML form instead of blade view template!?
i have tried to put some text or variable instead of blade template, that is throwing error like:

"View [This is sms!] not found." 
Sms::send('9090909090','sms.test',['param1'=>'Name 1']);

the above method works fine with blade view template.
but i would like to use POST method.

Multiple messages send to same user

Hi,

I'm using your plugin to send messages to users about meetings.
Actually all messages are send to the first number. If I use the Log gateway it records every message send to the good user (different from what it really appends), so I think it's probably a mistake in my code but I can't find where.
Any help would be greatly appreciated.

use Softon\Sms\Facades\Sms;

public function sendingSms()
{
    $day = Carbon::now();

    $fake_meetings = collect([]);

    $first = new stdClass();
    $first->phone = '0600000000';
    $first->date = $day->copy()->setDate(2017, 2, 21)->setTime(9, 0, 0);
    $fake_meetings->push($first);

    $second = new stdClass();
    $second->phone = '0600000001';
    $second->date = $day->copy()->setDate(2017, 2, 21)->setTime(9, 20, 0);
    $fake_meetings->push($second);

    $fake_meetings->each(function ($meeting) {
        $date = $meeting->date;
        $date = utf8_encode($date->formatLocalized('%A %d %B %Y %H:%M'));

        $message_datas = [
            'begins_at' => $date,
        ];

        self::getSmsRecall($meeting->phone, $message_datas);
    });
}

And the method that use your plugin to send messages

private static function getSmsRecall($phone, $message_datas)
{
    $r = Sms::send($phone, 'sms.recall', [
        'begins_at' => $message_datas['begins_at'],
    ]);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.