enniel / laravel-asterisk-notification-channel
Asterisk Notifications Driver
Installs: 1 660
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.4
- enniel/ami: ~2.1.0
- illuminate/notifications: ~5.3
- illuminate/support: ~5.1
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-11-06 03:59:14 UTC
README
This package makes it easy to send notifications using Asterisk Manager Interface (AMI) and Asterisk Chan Dongle with Laravel 5.3.
Contents
Installation
You can install this package via composer:
composer require enniel/laravel-asterisk-notification-channel
Next add the service provider to your config/app.php
:
... 'providers' => [ ... NotificationChannels\Asterisk\AsteriskServiceProvider::class, ], ...
Setting up the Asterisk service
Usage
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\Asterisk\AsteriskChannel; use NotificationChannels\Asterisk\AsteriskMessage; use Illuminate\Notifications\Notification; class ExampleNotification extends Notification { public function via($notifiable) { return [AsteriskChannel::class]; } public function toAsterisk($notifiable) { return AsteriskMessage::create('message text'); } }
In order to let your Notification know which phone number you are targeting, add the routeNotificationForAsterisk
method to your Notifiable model.
Important note: Asterisk requires the recipients phone number to be in international format. For instance: 0031612345678
public function routeNotificationForAsterisk() { return '0031612345678'; }
Available message methods
content('test')
: Set message text.device('modem1')
: Set device for sending SMS message.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.