1. Go to this page and download the library: Download insense/laravel-sms library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
insense / laravel-sms example snippets
$isTransactionalMsg = false;
$recipient1 = "XXXXXXXXXX";
$recipient2 = "XXXXXXXXXX";
$recipients = [$recipient1, $recipient2];
$msgText = "Your SMS text should be typed here";
SMS::driver()->sendSms($recipients, $msgText, $isTransactionalMsg);
class SMSReport extends BaseModel
{
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'sms_report_id';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = "sms_reports";
}
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
// to listen for Delivery Report of SMS, populate `SMSReport` Model
'Insense\LaravelSMS\Events\SMSDeliveryEvent' => [
'App\Listeners\YourListener1',
],
// to listen for sms sent api triggered, client can now wait for delivery report
'Insense\LaravelSMS\Events\SMSSentEvent' => [
'App\Listeners\YourListener2',
],
// to listen for unsubscribed any user(Laravel User) from application because of incorrect number
'Insense\LaravelSMS\Events\SMSUnsubscribeEvent' => [
'App\Listeners\YourListener3',
],
];
/**
* Send an SMS to a Group of contacts - group IDs can be retrieved from getGroups()
* @param $groupId
* @param $message
* @param bool $transactional
* @param bool $unicode
* @param array $options test, receipt_url, custom, optouts, validity
* @return array|mixed
* @throws Exception
*/
SMS::sendSmsGroup($groupId, $message = null, $transactional = false, $unicode = false, Carbon $scheduleTime = null, array $options = []);
/**
* Create a new contact group
* @param $group_name
* @return string group id
*/
SMS::createGroup($group_name);
/**
* Get contacts from a group - Group IDs can be retrieved with the getGroups() function
* @param $groupId
* @return array SMSContacts
*/
SMS::getContacts($groupId = null);