enniel / laravel-smsru-notification-channel
SmsRu Notifications Driver
Installs: 11 387
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.4
- illuminate/notifications: ^5.3
- illuminate/support: ^5.1|^5.2|^5.3
- zelenin/smsru: ~4.1.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-12-06 03:56:08 UTC
README
This package makes it easy to send notifications using sms.ru with Laravel 5.3.
Contents
Installation
You can install this package via composer:
composer require enniel/laravel-smsru-notification-channel
Next add the service provider to your config/app.php
:
... 'providers' => [ ... NotificationChannels\SmsRu\SmsRuServiceProvider::class, ], ...
Setting up the configuration
Add your API ID (secret key) and default sender name to your config/services.php
:
// config/services.php ... 'smsru' => [ 'api_id' => env('SMSRU_API_ID'), 'sender' => 'John_Doe' ], ...
Usage
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\SmsRu\SmsRuChannel; use NotificationChannels\SmsRu\SmsRuMessage; use Illuminate\Notifications\Notification; class ExampleNotification extends Notification { public function via($notifiable) { return [SmsRuChannel::class]; } public function toSmsRu($notifiable) { return SmsRuMessage::create('message text'); } }
In order to let your Notification know which phone number you are targeting, add the routeNotificationForSmsRu
method to your Notifiable model.
Available message methods
from()
: Sets the sender's name.text()
: Sets a text of the notification message.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.