vikki-user / turbosms
TurboSMS Notification notifications driver for Laravel 5.7+.
Requires
- php: >=7.1.3
- laravel/framework: 5.7.*|5.8.*
Requires (Dev)
- mockery/mockery: 1.2.2
- phpunit/phpunit: ~6.0
README
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.