PHP code example of shiroamada / gosms

1. Go to this page and download the library: Download shiroamada/gosms 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 / gosms example snippets


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

// config/services.php
...
'gosms' => [
    'company'   => env('GOSMS_COMPANY'),
    'username'  => env('GOSMS_USERNAME'),
    'password'  => env('GOSMS_PASSWORD'),
    'sender'    => env('GOSMS_SENDER'),
    'gateway'   => env('GOSMS_GATEWAY', 'L'),
    'mode'      => env('GOSMS_MODE', 'BUK'),
    'type'      => env('GOSMS_TYPE', 'TX'),
    'charge'    => env('GOSMS_CHARGE', '0'),
    'maskid'    => env('GOSMS_MASKID', '1'),
    'convert'   => env('GOSMS_CONVERT', '0')
],
...

use Illuminate\Notifications\Notification;
use NotificationChannels\GoSms\GoSmsMessage;
use NotificationChannels\GoSms\GoSmsChannel;

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

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

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