PHP code example of va / smart-sms
1. Go to this page and download the library: Download va/smart-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/ */
va / smart-sms example snippets
php artisan vendor:publish --tag=smart-sms
php artisan make:sms-notification SendActivationNotification
app/Notifications/Message/SendActivationNotification.php
namespace App\Notifications\Message;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Va\SmartSms\Channels\SmartSmsChannel;
class SendActivationNotification extends Notification
{
use Queueable;
public $message;
public $mobile;
public $group;
/**
* SendActivationNotification constructor.
* @param string|null $message
* @param string|null $mobile
* @param array $group
*/
public function __construct(string $message = null, string $mobile = null, array $group = [])
{
$this->message = $message;
$this->mobile = $mobile;
$this->group = $group;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [SmartSmsChannel::class];
}
public function toChannel()
{
return [
'text' => "You're message" OR $this->message, // You're default (text of message)
'mobile' => $this->mobile,
'group' => $this->group
];
}
}