LaravelPackages.net
Acme Inc.
Toggle sidebar
rubium/redsms

Package for send sms via redsms.ru. Based on official PHP class https://github.com/redsms/api-samples-php

1.059
1
v0.2
About rubium/redsms

rubium/redsms is a Laravel package for package for send sms via redsms.ru. based on official php class https://github.com/redsms/api-samples-php. It currently has 1 GitHub stars and 1.059 downloads on Packagist (latest version v0.2). Install it with composer require rubium/redsms. Discover more Laravel packages by rubium or browse all Laravel packages to compare alternatives.

Last updated

Laravel redsms.ru notifications

Software License Travis Total Downloads

Install

composer require rubium/redsms

php artisan vendor:publish --provider="Rubium\RedSms\RedSmsServiceProvider"

Usage

Package for send sms via redsms.ru. Based on official PHP class https://github.com/redsms/api-samples-php. This is package provide Channel and base Notification.

Create file config/redsms.php with content: (For details please read documentation https://redsms.ru/integration/api/):

<?php

return [
    //Login
    'login' => env('REDSMS_LOGIN', ''),
    //API Key
    'api_key' => env('REDSMS_API_KEY', ''),

    'api_url' => env('REDSMS_API_URL', null),

    'from' => env('REDSMS_PHONE', ''), //

    'sms_sender_name' => env('REDSMS_SMS_SENDER_NAME', 'REDSMS.RU'), //

    'viber_sender_name' => env('REDSMS_VIBER_SENDER_NAME', 'REDSMS.RU'), //
];

Examples:

notify method (notifiable should have phone property):

use Rubium\RedSms\Notifications\RedSms;
...
$user->notify(new RedSms('test'));

In Notification:

  public function via($notifiable)
  {
        return [RedSmsChannel::class];
  }   

  public function toSms($notifiable)
  {
        return [
              'phone' => $this->phone,
              'message' => $this->message
        ];
  }

Facade:

RedSms::send('89881234567', 'test'); // return bool

Testing

Run the tests with:

vendor/bin/phpunit

Credits

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Comments