fomvasss/laravel-notification-channel-turbo-sms

This package makes it easy to send notifications using [turbosms.ua](https://turbosms.ua) with Laravel 5.5+

1.2.0 2024-03-20 19:19 UTC

This package is auto-updated.

Last update: 2024-04-20 19:46:03 UTC


README

Here's the latest documentation on Laravel's Notifications System:

https://laravel.com/docs/master/notifications

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 turbosms.ua with Laravel 5.5+.

Contents

Installation

Install this package with Composer:

composer require fomvasss/laravel-notification-channel-turbo-sms

The service provider gets loaded automatically. Or you can do this manually:

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

Setting up the TurboSms service

Add your TurboSms token, default sender name (or phone number), test mode to your config/services.php:

// config/services.php
...
'turbosms' => [
    'api_token'  => env('TURBOSMS_API_TOKEN'),
    'sender'  => env('TURBOSMS_SENDER'),
    'is_test'  => env('TURBOSMS_IS_TEST'),
],
...

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 (new TurboSmsMessage())->content("Hello SMS!!!")->test(true);
    }
}

In your notifiable model, make sure to include a routeNotificationForTurboSms() method, which returns a phone number or an array of phone numbers.

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

Available methods

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

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

time(): Example argument = time() + 7*60*60 - Postpone shipping for 7 hours.

test(): Test SMS sending (log)

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

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