astrotomic/notifynder-sender-nexmo

Nexmo Sender for the Notifynder package.

1.1.0 2017-01-16 09:39 UTC

README

GitHub release GitHub license GitHub issues Total Downloads

Travis branch StyleCI

Code Climate

Slack Team Slack join

Documentation: Notifynder Docu

Installation

Step 1

composer require astrotomic/notifynder-sender-nexmo

Step 2

Add the following string to config/app.php

Providers array:

Astrotomic\Notifynder\NotifynderSenderNexmoServiceProvider::class,

Step 3

Add the following array to config/notifynder.php

'senders' => [
    'nexmo' => [
        'key' => '',
        'secret' => '',
        'store' => false, // wether you want to also store the notifications in database
    ],
],

Register the sender callback in your app/Providers/AppServiceProvider.php

<?php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Astrotomic\Notifynder\Senders\NexmoSender;
use Astrotomic\Notifynder\Senders\Messages\SmsMessage;
use Fenos\Notifynder\Builder\Notification;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        app('notifynder.sender')->setCallback(NexmoSender::class, function (SmsMessage $message, Notification $notification) {
            return $message
                ->from('0123456789')
                ->to('9876543210')
                ->text($notification->getText());
        });
    }
}