PHP code example of laravel-notification-channels / turbosms

1. Go to this page and download the library: Download laravel-notification-channels/turbosms 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/ */

    

laravel-notification-channels / turbosms example snippets


// config/services.php
...
    'turbosms' => [
        'wsdlEndpoint' => env('TURBOSMS_WSDLENDPOINT', 'http://turbosms.in.ua/api/wsdl.html'),
        'login' => env('TURBOSMS_LOGIN'),
        'password' => env('TURBOSMS_PASSWORD'),
        'sender' => env('TURBOSMS_SENDER'),
        'debug' => env('TURBOSMS_DEBUG', false), //will log sending attempts and results
        'sandboxMode' => env('TURBOSMS_SANDBOX_MODE', false) //will not invoke API call
    ],
...

use Illuminate\Notifications\Notification;
use NotificationChannels\TurboSMS\TurboSMSMessage;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return ["turbosms"];
    }

    public function toTurboSMS($notifiable)
    {
        return (new TurboSMSMessage("Your account was approved!"));       
    }
}

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

Notification::route('turbosms', '+380501111111')                      
            ->notify(new AccountApproved());