astrotomic / notifynder-sender-messagebird
This package is abandoned and no longer maintained.
The author suggests using the laravel-notification-channels/messagebird package instead.
MessageBird Sender for the Notifynder package.
1.2.0
2017-02-09 13:24 UTC
Requires
- php: >=5.5.0
- astrotomic/notifynder-abstract-call: ^1.0
- astrotomic/notifynder-abstract-sms: ^1.0
- fenos/notifynder: ^4.0
- illuminate/support: ~5.0
- messagebird/php-rest-api: ^1.6
Requires (Dev)
- laravel/framework: ~5.0
This package is not auto-updated.
Last update: 2019-10-22 12:01:49 UTC
README
Documentation: Notifynder Docu
Installation
Step 1
composer require astrotomic/notifynder-sender-messagebird
Step 2
Add the following string to config/app.php
Providers array:
Astrotomic\Notifynder\NotifynderSenderMessageBirdServiceProvider::class,
Step 3
Add the following array to config/notifynder.php
'senders' => [ 'messagebird' => [ 'access_key' => '', 'callbacks' => [ 'sms' => function(\Astrotomic\Notifynder\Senders\Messages\SmsMessage $message, \Fenos\Notifynder\Models\Notification $notification) { return $message ->from(...) ->to(...) ->body($notification->getText()); }, 'voice' => function(\Astrotomic\Notifynder\Senders\Messages\CallMessage $message, \Fenos\Notifynder\Models\Notification $notification) { return $message ->from(...) ->to(...) ->body($notification->getText()) ->lang('en-gb') ->male(); }, ], '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\MessageBirdSmsSender; use Astrotomic\Notifynder\Senders\Messages\SmsMessage; use Astrotomic\Notifynder\Senders\MessageBirdCallSender; use Astrotomic\Notifynder\Senders\Messages\CallMessage; use Fenos\Notifynder\Builder\Notification; class AppServiceProvider extends ServiceProvider { public function boot() { app('notifynder.sender')->setCallback(MessageBirdSmsSender::class, function (SmsMessage $message, Notification $notification) { return $message ->from('0123456789') ->to('9876543210') ->text($notification->getText()); }); app('notifynder.sender')->setCallback(MessageBirdCallSender::class, function (CallMessage $message, Notification $notification) { return $message ->from('0123456789') ->to('9876543210') ->lang('en-us') ->male() ->text($notification->getText()); }); } }