PHP code example of shiroamada / ultrasms-laravel-notification

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

    

shiroamada / ultrasms-laravel-notification example snippets


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

// config/services.php
...
'ultrasms' => [
    'isEnable' => env('ULTRASMS_ENABLE') ?? 0,
    'instanceId' => env('ULTRASMS_INSTANCEID'),
    'token' => env('ULTRASMS_TOKEN'),
    'isMalaysiaMode' => env('ULTRASMS_MALAYSIA_MODE') ?? 0,
    'isDebug' => env('ULTRASMS_DEBUG_ENABLE') ?? 0,
    'debugReceiveNumber' => env('ULTRASMS_DEBUG_RECEIVE_NUMBER'),
],
...

use Illuminate\Notifications\Notification;
use NotificationChannels\UltraSms\UltraSmsMessage;
use NotificationChannels\UltraSms\UltraSmsChannel;

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

    public function toUltraSms($notifiable)
    {
        return UltraSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

public function routeNotificationForUltraSms()
{
    return $this->mobile; //depend what is your db field
}