leadthread/laravel-sms
| Install | |
|---|---|
composer require leadthread/laravel-sms |
|
| Latest Version: | 2.1.2 |
| PHP: | ^5.5.9|^7.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Mar 10, 2022 |
| Links: | GitHub · Packagist |
laravel-sms
Please read the README for the latest stable branch v2.1.2
Laravel SMS is a simple Laravel 5 package for sending messages to different SMS services.
Currently supported:
Installation
Install via composer - In the terminal:
composer require leadthread/laravel-sms
Install Plivo or Twilio SDK
composer require plivo/plivo-php:^1.1
# or
composer require twilio/sdk:^4.10
# or
composer require bandwidth/catapult:^0.8.2
Now add the following to the providers array in your config/app.php
LeadThread\Sms\Providers\SmsServiceProvider::class
and this to the aliases array in config/app.php
"Sms" => "LeadThread\Sms\Facades\Sms",
Then you will need to run these commands in the terminal in order to copy the config file
php artisan vendor:publish
Usage
First you must change your config file located at config/sms.php with your proper API credentials.
Sending Messages
You can simply send a message like this:
# Send one text
$message = "Hello Phone!";
$to = "+15556667777";
$from = "+17776665555";
$response = Sms::send($message,$to,$from);
# Send many texts
$message = "Hello Phone!";
$to = ["+15556667777","+15556667778","+15556667779"];
$from = "+17776665555";
$response = Sms::sendMany($message,$to,$from);
# Send many texts with different messages
$items = [
["msg"=>"Hello Rick!", "to"=>"+15556667777","from"=>"+17776665555"],
["msg"=>"Hello Tyler!","to"=>"+15556667778","from"=>"+17776665555"],
["msg"=>"Hello Karla!","to"=>"+15556667779","from"=>"+17776665555"],
];
$response = Sms::sendArray($items);
Dont forget to add this to the top of the file
//If you updated your aliases array in "config/app.php"
use Sms;
//or if you didnt...
use LeadThread\Sms\Facades\Sms;
Buying and Selling phone numbers
$areacode = '435';
//Search for a number to buy
//The response is different for each SMS service provider. This example shows Plivo.
$response = Sms::searchNumber($areacode);
$number = $response['response']['objects'][0]['number'];
//Buy the number
Sms::buyNumber($number);
//Unrent the number
Sms::sellNumber($number);
Contributing
Contributions are always welcome! If you would like to have another service added to the list please request it by opening up an issue or sending a pull request
Related Packages
Laravel package to provide SMS API integration. Any SMS vendor that provides RES...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.1.2 | ^5.5.9| | ^5.2 | MIT | |
| 2.1.1 | ^5.5.9| | ^5.2 | MIT | |
| 2.1.0 | ^5.5.9| | ^5.2 | MIT | |
| 2.0.1 | ^5.5.9| | ^5.2 | MIT | |
| 2.0.0 | ^5.5.9| | ^5.2 | MIT | |
| 1.3.0 | ^5.5.9| | ^5.2 | MIT | |
| 1.2.1 | ^5.5.9| | ^5.2 | MIT | |
| 1.2.0 | ^5.5.9| | ^5.2 | MIT | |
| 1.1.0 | ^5.5.9| | ^5.2 | MIT | |
| 1.0.0 | ^5.5.9| | ^5.2 | MIT |
Pre-releases (14)
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 3.0.0-beta.14 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.13 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.12 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.11 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.10 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.9 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.8 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.7 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.6 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.5 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.4 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.3 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta.2 | ^5.5.9| | ^5.2 | MIT | |
| 3.0.0-beta | ^5.5.9| | ^5.2 | MIT |

