Skip to content

projct1/new-channels

 
 

Repository files navigation

Redsms notifications channel for Laravel 5.3+

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using redsms.ru with Laravel 5.3+.

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/redsms-ru

Then you must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\RedsmsRu\RedsmsRuServiceProvider::class,
],

Setting up the RedsmsRu service

Add your RedsmsRu login, API key (hashed password) and default sender name to your config/services.php:

// config/services.php
...
'redsmsru' => [
    'login'  => env('REDSMSRU_LOGIN'),
    'secret' => env('REDSMSRU_SECRET'),
    'sender' => env('REDSMSRU_SENDER')
],
...

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\RedsmsRu\RedsmsRuMessage;
use NotificationChannels\RedsmsRu\RedsmsRuChannel;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [RedsmsRuChannel::class];
    }

    public function toRedsmsRu($notifiable)
    {
        return new RedsmsRuMessage("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForRedsmsru() method, which return the phone number.

public function routeNotificationForRedsmsru()
{
    return $this->phone;
}

Available methods

text(): Set a text of the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Submit pull requests here for new notification channels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%