Unisender Notifications Channel for Laravel

0.9.0 2017-12-03 05:57 UTC

This package is auto-updated.

Last update: 2024-04-07 07:15:53 UTC


Build Status StyleCI ScrutinizerCI Latest Version on Packagist Software License


This package requires PHP 7.1 or higher.


You can install the package via composer:

$ composer require tzurbaev/unisender-notifications-channel

Setting up the Unisender Service

Add Unisender API key to the config/services.php file:

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

This key will be used as default key for all notifications. You can always override it for concrete notifications.


Add UnisenderChannell::class to notification's via method and implement toUnisender($notifiable) method:


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)
            ->content('Your subscription is active!');

Also, your Notifiable classes must have the routeNotificationForUnisender method, which should return single phone number (E.164 format) or list of phone numbers (comma-separated or in array).


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'];

Available Methods

  • UnisenderMessage::silent(bool $flag = true) - sets the 'silent mode' - Channel won't throw any exception while sending SMS;
  • UnisenderMessage::usingAccessToken($token) - reset token only for the current message;
  • UnisenderMessage::from(string $from) - set the sender name;
  • UnisenderMessage::content(string $content) - set the message content.

Change log

Please see CHANGELOG for more information on what has changed recently.


$ vendor/bin/phpunit


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.


The MIT License (MIT). Please see License File for more information.