PHP code example of mobtexting / mobtexting-laravel

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

    

mobtexting / mobtexting-laravel example snippets


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

// config/services.php
...
'mobtexting' => [
    'username' => env('MOBTEXTING_USERNAME'), // optional when using auth token
    'password' => env('MOBTEXTING_PASSWORD'), // optional when using auth token
    'token' => env('MOBTEXTING_AUTH_TOKEN'), // optional when using username and password
    'from' => env('MOBTEXTING_FROM'), // optional
    'service' => env('MOBTEXTING_SERVICE'), // optional
],
...

public function routeNotificationForMobtexting()
{
    return '+1234567890';
}
 php
use NotificationChannels\Mobtexting\MobtextingChannel;
use NotificationChannels\Mobtexting\MobtextingSmsMessage;
use Illuminate\Notifications\Notification;

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

    public function toMobtexting($notifiable)
    {
        return (new MobtextingSmsMessage())
            ->text("Your {$notifiable->service} account was approved!");
    }
}