sashalenz/laravel-notification-channel-turbosms

Turbo SMS Notification channel for Laravel.

2.1.0 2024-04-01 12:59 UTC

This package is auto-updated.

Last update: 2024-10-31 00:24:09 UTC


README

Based on github.com/laravel-notification-channels/smsc-ru

This package made for send notifications using turbosms.ua with Laravel 7.0+.

Contents

Installation

You can install the package via composer:

composer require sashalenz/laravel-notification-channel-turbosms

For Laravel < 5.5 you must install the service provider:

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

Setting up the TurboSms service

Add your TurboSms login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:

// config/services.php
...
'turbosms' => [
    'login' => env('TURBOSMS_LOGIN'),
    'secret' => env('TURBOSMS_SECRET'),
    'sender' => 'John Doe',
    'url' => 'http://turbosms.in.ua/api/wsdl.html',
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\TurboSms\TurboSmsMessage;
use NotificationChannels\TurboSms\TurboSmsChannel;

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

    public function toTurboSms($notifiable)
    {
        return TurboSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

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

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

Available methods

from(): Sets the sender's name or phone number.

content(): Sets a content of the notification message.

Security

If you discover any security related issues, please email ss.yakim@gmail.com 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.