PHP code example of infinitypaul / laravel-notification-channel-termii

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

    

infinitypaul / laravel-notification-channel-termii example snippets


// config/app.php
'providers' => [
    ...
    Infinitypaul\Termii\TermiiServiceProvider::class,
],


// config/services.php
'termii' => [
'api_key' => env('TERMII_API_KEY'),
'from' => env('TERMII_FROM'),
'channel' => 'dnd' //because I know you love 'do not disturb' mode 😉
]

use Infinitypaul\Termii\TermiiChannel;
use Infinitypaul\Termii\TermiiMessage;
use Illuminate\Notifications\Notification;

class WelcomeSMS extends Notification
{
    public function via($notifiable)
    {
        return [TermiiChannel::class]; // see? pie!
    }

    public function toTermii($notifiable)
    {
        return (new TermiiMessage())
            ->content("Thanks For Subscribing to infinitypaul.medium.com. We promise to only send interesting stuff, no cat videos... well, maybe just one.");
    }
}

public function routeNotificationForTermii()
{
    return $this->phone; // where `phone` is a field in your users table;
}

public function toTermii($notifiable)
    {
        return (new TermiiMessage())
            ->content("Thanks For Subscribing to infinitypaul.medium.com. We promise to only send interesting stuff, no cat videos... well, maybe just one.")
            ->to("234100000001");
    }

composer test //(We promise it won't explode.)