PHP code example of hafael / totalvoice-notification-channel

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

    

hafael / totalvoice-notification-channel example snippets


// config/app.php
'providers' => [
    ...
    NotificationChannels\TotalVoice\TotalVoiceServiceProvider::class,
],

// config/services.php
...
'totalvoice' => [
    'access_token' => env('TOTALVOICE_ACCESS_TOKEN'),
],
...

public function routeNotificationForTotalVoice()
{
    return '+5521999999999';
}
 php
use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceSmsMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TotalVoiceChannel::class];
    }

    public function toTotalVoice($notifiable)
    {
        return (new TotalVoiceSmsMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}
 php
use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceTtsMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TotalVoiceChannel::class];
    }

    public function toTotalVoice($notifiable)
    {
        return (new TotalVoiceTtsMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}
 php
use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceAudioMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TotalVoiceChannel::class];
    }

    public function toTotalVoice($notifiable)
    {
        return (new TotalVoiceAudioMessage())
            ->content("http://foooo.bar/audio.mp3");
    }
}