2017 © Pedro Peláez
 

library unisender-notifications-channel

Unisender Notifications Channel for Laravel

image

tzurbaev/unisender-notifications-channel

Unisender Notifications Channel for Laravel

  • Tuesday, May 8, 2018
  • by tzurbaev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 77 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 5 % Grown

The README.md

Unisender Notifications Channel For Laravel 5.5+

Build Status ![StyleCI][ico-styleci] ScrutinizerCI Latest Version on Packagist ![Software License][ico-license], (*1)

Requirements

This package requires PHP 7.1 or higher., (*2)

Installation

You can install the package via composer:, (*3)

``` bash $ composer require tzurbaev/unisender-notifications-channel, (*4)


### Setting up the Unisender Service Add Unisender API key to the `config/services.php` file: ```php 'unisender' => [ 'api-key' => 'KEY_HERE', ],

This key will be used as default key for all notifications. You can always override it for concrete notifications., (*5)

Documentation

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

<?php

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!');
    }
}

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)., (*7)

<?php

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., (*8)

Testing

bash $ vendor/bin/phpunit, (*9)

Contributing

Please see CONTRIBUTING for details., (*10)

Security

If you discover any security related issues, please email zurbaev@gmail.com instead of using the issue tracker., (*11)

License

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

The Versions

08/05 2018

dev-master

9999999-dev

Unisender Notifications Channel for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar tzurbaev

03/12 2017

0.9.0

0.9.0.0

Unisender Notifications Channel for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar tzurbaev