1. Go to this page and download the library: Download emotality/laravel-everlytic 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 Emotality\Everlytic\EverlyticSms;
use Emotality\Everlytic\EverlyticSmsChannel;
use Illuminate\Notifications\Notification;
class ExampleNotification extends Notification
{
// Notification channels
public function via($notifiable)
{
return ['mail', EverlyticSmsChannel::class];
}
// Send email
public function toMail($notifiable)
{
return new \App\Mail\ExampleMail($notifiable);
}
// Send SMS
public function toSms($notifiable) // Can also use toEverlytic($notifiable)
{
// Send SMS to a single recipient
return (new EverlyticSms())
->to($notifiable->mobile) // Assuming $user->mobile
->message("1st Line\n2nd Line\n3rd Line");
// or send SMS to multiple recipients
return (new EverlyticSms())
->toMany(['+27820000001', '+27820000002'])
->message("1st Line\n2nd Line\n3rd Line");
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.