https://github.com/laravel-notification-channels/smsc-ru
smsc.ru notifications channel for Laravel 5.3+
https://github.com/laravel-notification-channels/smsc-ru
laravel notifications smsc smsc-api
Last synced: about 1 month ago
JSON representation
smsc.ru notifications channel for Laravel 5.3+
- Host: GitHub
- URL: https://github.com/laravel-notification-channels/smsc-ru
- Owner: laravel-notification-channels
- License: mit
- Created: 2016-08-12T23:36:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-15T07:51:49.000Z (2 months ago)
- Last Synced: 2025-05-14T07:58:13.432Z (about 1 month ago)
- Topics: laravel, notifications, smsc, smsc-api
- Language: PHP
- Homepage: http://laravel-notification-channels.com/
- Size: 83 KB
- Stars: 51
- Watchers: 6
- Forks: 43
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Smsc notifications channel for Laravel 5.3+
[](https://packagist.org/packages/laravel-notification-channels/smsc-ru)
[](LICENSE.md)
[](https://travis-ci.org/laravel-notification-channels/smsc-ru)
[](https://styleci.io/repos/65589451)
[](https://insight.sensiolabs.com/projects/aceefe27-ba5a-49d7-9064-bc3abea0abeb)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/smsc-ru)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/smsc-ru/?branch=master)
[](https://packagist.org/packages/laravel-notification-channels/smsc-ru)This package makes it easy to send notifications using [smsc.ru](https://smsc.ru) (aka СМС–Центр) with Laravel 5.3+.
## Contents
- [Installation](#installation)
- [Setting up the SmscRu service](#setting-up-the-SmscRu-service)
- [Usage](#usage)
- [Available Message methods](#available-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)## Installation
Install this package with Composer:
```bash
composer require laravel-notification-channels/smsc-ru
```If you're using Laravel 5.x you'll also need to specify a version constraint:
```bash
composer require laravel-notification-channels/smsc-ru -v 2.0.3
```The service provider gets loaded automatically. Or you can do this manually:
```php
// config/app.php
'providers' => [
...
NotificationChannels\SmscRu\SmscRuServiceProvider::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`:
```php
// config/services.php
...
'smscru' => [
'login' => env('SMSCRU_LOGIN'),
'secret' => env('SMSCRU_SECRET'),
'sender' => 'John_Doe',
'extra' => [
// any other API parameters
// 'tinyurl' => 1
],
],
...
```> If you want use other host than `smsc.ru`, you MUST set custom host WITH trailing slash.
```
// .env
...
SMSCRU_HOST=http://www1.smsc.kz/
...
``````php
// config/services.php
...
'smscru' => [
...
'host' => env('SMSCRU_HOST'),
...
],
...
```## Usage
You can use the channel in your `via()` method inside the notification:
```php
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.```php
public function routeNotificationForSmscru()
{
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](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [JhaoDa](https://github.com/jhaoda)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.