Package Data | |
---|---|
Maintainer Username: | laravel-notification-channels |
Maintainer Contact: | jhaoda@gmail.com (JhaoDa) |
Package Create Date: | 2016-08-12 |
Package Last Update: | 2023-07-12 |
Home Page: | http://laravel-notification-channels.com/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:14:49 |
Package Statistics | |
---|---|
Total Downloads: | 158,712 |
Monthly Downloads: | 2,470 |
Daily Downloads: | 149 |
Total Stars: | 51 |
Total Watchers: | 7 |
Total Forks: | 44 |
Total Open Issues: | 4 |
This package makes it easy to send notifications using smsc.ru (aka СМС–Центр) with Laravel 5.3+.
You can install the package via composer:
composer require laravel-notification-channels/smsc-ru
Then you must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\SmscRu\SmscRuServiceProvider::class,
],
Add your SmscRu login, secret key (hashed password) and default sender name (or phone number) to your config/services.php
:
// config/services.php
...
'smscru' => [
'login' => env('SMSCRU_LOGIN'),
'secret' => env('SMSCRU_SECRET'),
'sender' => 'John_Doe'
],
...
If you want use other host than
smsc.ru
, you MUST set custom host WITH trailing slash.
// .env
...
SMSCRU_HOST=http://www1.smsc.kz/
...
// config/services.php
...
'smscru' => [
...
'host' => env('SMSCRU_HOST'),
...
],
...
You can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification;
use NotificationChannels\SmscRu\SmscRuMessage;
use NotificationChannels\SmscRu\SmscRuChannel;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [SmscRuChannel::class];
}
public function toSmscRu($notifiable)
{
return SmscRuMessage::create("Task #{$notifiable->id} is complete!");
}
}
In your notifiable model, make sure to include a routeNotificationForSmscru()
method, which returns a phone number
or an array of phone numbers.
public function routeNotificationForSmscru()
{
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 test
If you discover any security related issues, please email jhaoda@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.