PHP code example of itsnubix / aws-sns-sms-channel
1. Go to this page and download the library: Download itsnubix/aws-sns-sms-channel 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\Notifications;
use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Nubix\Notifications\Messages\SmsMessage;
class SendHelloText extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return ['sms'];
}
/**
* Get the SMS representation of the notification.
*
* @param mixed $notifiable
*
* @return \App\Channels\Messages\SmsMessage
*/
public function toSms($notifiable)
{
return (new SmsMessage())
->content('Hello world');
}
}
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Return the SMS notification routing information.
*
* @param \Illuminate\Notifications\Notification|null $notification
*
* @return mixed
*/
public function routeNotificationForSms(?Notification $notification = null)
{
return $this->phone_number;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.