PHP code example of laravel-notification-channels / plivo

1. Go to this page and download the library: Download laravel-notification-channels/plivo 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/ */

    

laravel-notification-channels / plivo example snippets


// config/services.php
...
'plivo' => [
    'auth_id' => env('PLIVO_AUTH_ID'),
    'auth_token' => env('PLIVO_AUTH_TOKEN'),
    // Country code, area code and number without symbols or spaces
    'from_number' => env('PLIVO_FROM_NUMBER'),
],

use Illuminate\Notifications\Notification;
use NotificationChannels\Plivo\PlivoChannel;
use NotificationChannels\Plivo\PlivoMessage;

public function via($notifiable)
{
    return [PlivoChannel::class];
}

public function toPlivo($notifiable)
{
    return (new PlivoMessage)
                    ->content('This is a test SMS via Plivo using Laravel Notifications!');
}

public function routeNotificationForPlivo()
{
    // Country code, area code and number without symbols or spaces
    return preg_replace('/\D+/', '', $this->phone_number);
}