PHP code example of emotality / laravel-everlytic

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/ */

    

emotality / laravel-everlytic example snippets


'mailers' => [
    ...
    'everlytic' => [
        'transport' => 'everlytic',
    ],
],

\Everlytic::sms('+27820000001', "1st Line\n2nd Line\n3rd Line");

\Everlytic::smsMany(['+27820000001', '+27820000002'], "1st Line\n2nd Line\n3rd Line");

array:2 [▼
  "+27820000001" => true
  "+27820000002" => false
]

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");
    }
}