Skip to content

VikkiUser/turbosms

 
 

Repository files navigation

TurboSMS notifications channel for Laravel 5.7+

Software License Build Status StyleCI

This package makes it easy to send notifications using turbosms.ua with Laravel 5.7+.

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/turbosms

Thanks to Package Auto-Discovery In Laravel 5.5 you don't need to install the service provider manually.

Setting up the TurboSMS service

Initial steps:

Add your TurboSMS user, password and sender to your config/services.php:

// config/services.php
...
'turbosms' => [
    'login'  => env('TURBOSMS_LOGIN'),
    'password' => env('TURBOSMS_PASSWORD'),
    'sender' => env('TURBOSMS_SENDER'), // optional
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\TurboSms\{
    TurboSmsMessage, TurboSmsChannel
};

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

    public function toTurboSms( $notifiable ) : TurboSmsMessage
    {
        return ( new TurboSmsMessage() )
            ->content( 'Your {$notifiable->service} account was approved!' )
            ->sender( 'Sender' )
            ;
    }
}

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

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

Available methods

TurboSmsClient

getLastResults(): get array of notification's GUID styled ID.

TurboSmsMessage

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

getContent(): gets a content of the notification message.

sender(): sets the sender's name (or phone number as name).

getSender(): gets the sender's name.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

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

TurboSMS notifications channel for Laravel 5.7+

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%