vikki-user/turbosms
TurboSMS notifications channel for Laravel 5.7+
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:
- register account at turbosms.ua/registration.html
- add sender in turbosms.ua/sign/add.html
- create login and password for SOAP API at turbosms.ua/route.html
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.
Related Packages
Turbo SMS Notification channel for Laravel 5.3+.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.0.4 | >=7.1.3 | 5.7.*| | MIT | |
| v0.0.3 | >=7.1.0 | 5.7.* | MIT | |
| v0.0.2 | >=7.1.0 | 5.7.* | MIT | |
| v0.0.1 | >=7.1.0 | 5.7.* | MIT |