This package makes it easy to send notifications using turbosms.ua with Laravel 5.7+.
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.
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
],
...
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;
}
getLastResults()
: get array of notification's GUID styled ID.
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.
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email aia@auge.in.ua instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.