PHP code example of webregul / laravel-sms-ru-channel

1. Go to this page and download the library: Download webregul/laravel-sms-ru-channel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webregul / laravel-sms-ru-channel example snippets


// config/app.php
'providers' => [
    ...
    Kafkiansky\SmsRuChannel\SmsRuProvider::class,
],

// config/services.php

'sms_ru' => [
    'api_id' => env('SMS_RU_API_ID'),
    'login'  => env('SMS_RU_LOGIN', null),
    'password' => env('SMS_RU_PASSWORD', null),
    'partner_id' => env('SMS_RU_PARTNER', null),
    'test' => env('SMS_RU_TEST', 1),
    'json' => env('SMS_RU_JSON', 1),
    'from' => env('SMS_RU_FROM', null),
],

use Illuminate\Notifications\Notification;
use Kafkiansky\SmsRu\Message\SmsRuMessage;
use Kafkiansky\SmsRu\Message\To;
use Kafkiansky\SmsRuChannel\SmsRuChannel;

final class RegistrationComplete extends Notification
{
    public function via($notifiable)
    {
        return [SmsRuChannel::class];
    }

    public function toSmsRu($notifiable)
    {
        return new SmsRuMessage(new To($notifiable->phone, 'Congratulations, you have become part of our application'));
    }
}

use Illuminate\Notifications\Notifiable;

/**
 * @property string $phone
 */
class User
{
    use Notifiable;

    public function routeNotificationForSmsRu()
    {
        return $this->phone; // can be array of phone numbers
    }
}

use Illuminate\Notifications\Notification;
use Kafkiansky\SmsRuChannel\SmsRuChannel;

final class RegistrationComplete extends Notification
{
    public function via($notifiable)
    {
        return [SmsRuChannel::class];
    }

    public function toSmsRu($notifiable)
    {
        return 'Congratulations, you have become part of our application';
    }
}