PHP code example of lizhineng / dysms-notification-channel

1. Go to this page and download the library: Download lizhineng/dysms-notification-channel 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/ */

    

lizhineng / dysms-notification-channel example snippets


use Illuminate\Notifications\Notification;
use Zhineng\Notifications\Channels\DysmsChannel;
use Zhineng\Notifications\Messages\DysmsMessage;

class OrderPlaced extends Notification
{
    public function via($notifiable)
    {
        return ['dysms'];
    }

    public function toDysms($notifiable)
    {
        return (new DysmsMessage)
            ->using('SMS_TEMPLATE_CODE')
            ->with(['if' => 'any'])
            ->signedBy('YOUR_PERMITTED_SIGNATURE');
    }   
}

// App\Models\User.php

public function routeNotificationForDysms($notification)
{
    return $this->phone_number;
}