PHP code example of edemsky / sms-ru

1. Go to this page and download the library: Download edemsky/sms-ru 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/ */

    

edemsky / sms-ru example snippets


// config/app.php
'providers' => [
    ...
    NotificationChannels\SmsBee\SmsServiceProvider::class,
],

// config/services.php
...
'sms' => [
    'login'  => env('SMS_LOGIN'),
    'secret' => env('SMS_SECRET'),
    'sender' => 'John_Doe',
    'extra'  => [
        // any other API parameters
        // 'tinyurl' => 1
    ],
],
...

// config/services.php
...
'sms' => [
    ...
    'host' => env('SMSCRU_HOST'),
    ...
],
...

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!");
    }
}

public function routeNotificationForSms()
{
    return $this->phone;
}