edemsky / sms-ru
Sms Notifications channel for Laravel 5.3.
Requires
- php: >=7.2
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.0.1
- illuminate/notifications: 5.1 - 5.8|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/queue: 5.1 - 5.8|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: 5.1 - 5.8|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- mockery/mockery: ^1.3.1
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2025-05-04 15:19:31 UTC
README
This package makes it easy to send notifications with Laravel 5.3+.
Contents
Installation
Install this package with Composer:
composer require require edemsky/sms-ru
If you're using Laravel 5.x you'll also need to specify a version constraint:
composer require edemsky/sms-ru
The service provider gets loaded automatically. Or you can do this manually:
// config/app.php 'providers' => [ ... NotificationChannels\SmsBee\SmsServiceProvider::class, ],
Setting up the SmscRu service
Add your SmscRu login, secret key (hashed password) and default sender name (or phone number) to your config/services.php
:
// config/services.php ... 'sms' => [ 'login' => env('SMS_LOGIN'), 'secret' => env('SMS_SECRET'), 'sender' => 'John_Doe', 'extra' => [ // any other API parameters // 'tinyurl' => 1 ], ], ...
If you want use other host than sms, you MUST set custom host WITH trailing slash.
// .env
...
SMSCRU_HOST=http://www.sms.kz/
...
// config/services.php ... 'sms' => [ ... 'host' => env('SMSCRU_HOST'), ... ], ...
Usage
You can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification; use NotificationChannels\SmsBee\SmsMessage; use NotificationChannels\SmsBee\SmsChannel; class AccountApproved extends Notification { public function via($notifiable) { return [SmsChannel::class]; } public function toSms($notifiable) { return SmsMessage::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 routeNotificationForSms() { return $this->phone; }
Available methods
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.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email edemsky.m@gmail.com 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.