PHP code example of hachetaustralia / smsbroadcast
1. Go to this page and download the library: Download hachetaustralia/smsbroadcast 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/ */
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use NotificationChannels\SMSBroadcast\Events\MessageWasSent;
class SentMessageHandler
{
/**
* Handle the event.
*
* @param MessageWasSent $event
* @return void
*/
public function handle(MessageWasSent $event)
{
$response = $event->response;
$message = $event->message;
}
}
php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForSmsBroadcast()
{
return $this->mobile;
}
}
php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForSmsBroadcast()
{
return [ $this->mobile_primary, $this->mobile_secondary ];
}
}
php
use NotificationChannels\SMSBroadcast\SMSBroadcastChannel;
use NotificationChannels\SMSBroadcast\SMSBroadcastMessage;
use Illuminate\Notifications\Notification;
class VpsServerOrdered extends Notification
{
public function via($notifiable)
{
return [SMSBroadcastChannel::class];
}
public function toSMSBroadcast($notifiable)
{
return (new SMSBroadcastMessage("Your {$notifiable->service} was ordered!"));
}
}
php
return (new SMSBroadcastMessage("Your {$notifiable->service} was ordered!"))->setRecipients($recipients);
php
return (new SMSBroadcastMessage("Your {$notifiable->service} was ordered!"))->setReference($id);
php
return (new SMSBroadcastMessage("Your {$notifiable->service} was ordered!"))->setMaxSplit(2);
php
return (new SMSBroadcastMessage("Your {$notifiable->service} is ready to go!"))->setDelay(10);
php
return (new SMSBroadcastMessage("Your {$notifiable->service} is ready to go!"))->setPrivateReference(12345);
php
return (new SMSBroadcastMessage("Your {$notifiable->service} is ready to go!"))->setNoFrom();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.