This package makes it easy to send notifications using CorpSMS.ru (aka СМС–Центр) with Laravel 5.3+.
You can install the package via composer:
composer require laravel-notification-channels/corp-smsThen you must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\CorpSMS\CorpSMSServiceProvider::class,
],Add your CorpSMS login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:
// config/services.php
...
'corpsms' => [
'login' => env('SMS_AUTH_USER'),
'secret' => env('SMS_AUTH_PASSWORD'),
'sender' => 'CorpSMS'
],
...If you want use other host than
CorpSMS.ru, you MUST set custom host WITH trailing slash.
// .env
...
SMS_ENDPOINT=http://203.151.230.33/CorporateSMS_API/
...
// config/services.php
...
'corpsms' => [
...
'host' => env('SMS_ENDPOINT'),
...
],
...You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification;
use NotificationChannels\CorpSMS\CorpSMSMessage;
use NotificationChannels\CorpSMS\CorpSMSChannel;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [CorpSMSChannel::class];
}
public function toCorpSMS($notifiable)
{
return CorpSMSMessage::create("Task #{$notifiable->id} is complete!");
}
}In your notifiable model, make sure to include a routeNotificationForCorpSMS() method, which returns a phone number
or an array of phone numbers.
public function routeNotificationForCorpSMS()
{
return $this->phone;
}from(): Sets the sender's name or phone number.
content(): Set a content of the notification message.
sendAt(): Set a time for scheduling the notification message.
Please see CHANGELOG for more information what has changed recently.
$ composer testIf you discover any security related issues, please email jarak.krit@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.