PHP code example of tzurbaev / unisender-notifications-channel

1. Go to this page and download the library: Download tzurbaev/unisender-notifications-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/ */

    

tzurbaev / unisender-notifications-channel example snippets


'unisender' => [
    'api-key' => 'KEY_HERE',
],



namespace App\Notifications;

use Illuminate\Notifications\Notification;
use NotificationChannels\Unisender\UnisenderChannel;
use NotificationChannels\Unisender\UnisenderMessage;

class SubscriptionActivatedNotification extends Notification
{
    public function via($notifiable)
    {
        return [UnisenderChannel::class];
    }
    
    public function toUnisender($notifiable)
    {
        return (new UnisenderMessage)
            ->from('Laravel')
            ->content('Your subscription is active!');
    }
}



namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;
    
    public function routeNotificationForUnisender()
    {
        return '+79641234567'; // or ['+79641234567', '+79831234567'];
    }
}