Giter Site home page Giter Site logo

sparrow's Introduction

Sparrow SMS Laravel Package

Latest Version Issues Downloads

Sparrow SMS Laravel Package can be used to send SMS via Sparrow SMS or query account's credits.

Getting Started

This package can be installed through Composer.

composer require thebikramlama/sparrow

Publish sparrow.php config file for customization

php artisan vendor:publish --provider="Thebikramlama\Sparrow\SparrowServiceProvider"

How to send an SMS

After the installation is complete, Sparrow alias is generated by default.

Using the default Alias

// Using Default 
use Sparrow;

Send an SMS

$from = 'InfoSms'; // Setting FROM provided by Sparrow
$access_token = 'YOUR_ACCESS_TOKEN'; // Setting Access Token provided by Sparrow

$to = '9801234567'; // Setting Phone Number
$message = 'Test message from Sparrow.'; // Setting Message

// Send the message
$sms_message = Sparrow::send($to, $message, $from, $access_token);
// This will return a pseudo JSON response, you will need to json_decode it.

Getting available Credits

$access_token = 'YOUR_ACCESS_TOKEN'; // Setting Access Token provided by Sparrow

// Query Credits
$credits = Sparrow::credits($access_token);
echo 'Available credits: '. json_decode($credits)->credits_available; // Available credits: 1500

Customization

Make sure you have published sparrow.php config file

php artisan vendor:publish --provider="Thebikramlama\Sparrow\SparrowServiceProvider"

You can find the sparrow.php config file under config/sparrow.php inside your laravel project.

You can edit the file as per your need.

// Your Sparrow SMS Access Token here.
'access_token' => 'YOUR_ACCESS_TOKEN',
// Identity Provided by Sparrow SMS
'from' => 'FROM',

After updating the sparrow.php config file you can call Sparrow methods with lesser arguments.

Example:

$sms_message = Sparrow::send('98081234567', 'Test Messsage'); // From and Access token are optional
$credits = Sparrow::credits(); // Access token is optional

Credits

License

The MIT License (MIT). Please see License File for more information.

sparrow's People

Contributors

thebikramlama avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

sparrow's Issues

issue on assigning $to ie. phonenumber

i was going through your work , when i use the below condition it sucessfully sends the message or even if i put i single number as $to in my config it works.
$sms_message = Sparrow::send('1234567890,'This is message')
Issue here is i have $phonenumber and i want to pass it here
$sms_message = Sparrow::send($phonenumber,'This is message')
even if the number is int/string it doesnot work .
How can admin pass different number from database without assigning variable here.


issue solved
it was not the issue i changed the identity to other name thats why message was not sending , identity must be Demo unless it is changed .

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.