fomvasss / laravel-notification-channel-turbo-sms
This package makes it easy to send notifications using [turbosms.ua](https://turbosms.ua) with Laravel 5.5+
Installs: 1 937
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=7.2
- illuminate/notifications: ^5.5|^6|^7|^8|^9|^10|^11
- illuminate/support: ^5.5|^6|^7|^8|^9|^10|^11
README
Here's the latest documentation on Laravel's Notifications System:
https://laravel.com/docs/master/notifications
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'), // for test sending use TAXI 'is_test' => env('TURBOSMS_IS_TEST'), // optional 'timeout' => env('TURBOSMS_TIMEOUT'), 'connect_timeout' => env('TURBOSMS_CONNECT_TIMEOUT'), ], ...
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.