LaravelPackages.net
Acme Inc.
Toggle sidebar
pugofka/laravel-smsru-notification-channel

SmsRu Notifications Driver

8
0
1.0.0
About pugofka/laravel-smsru-notification-channel

pugofka/laravel-smsru-notification-channel is a Laravel package for smsru notifications driver. It currently has 0 GitHub stars and 8 downloads on Packagist (latest version 1.0.0). Install it with composer require pugofka/laravel-smsru-notification-channel. Discover more Laravel packages by pugofka or browse all Laravel packages to compare alternatives.

Last updated

SMS notification channel for Laravel

This package makes it easy to send notifications using sms.ru with Laravel.

Contents

Installation

You can install this package via composer:

composer require pugofka/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.

Star History Chart