PHP code example of kgoofori / widepay-sms-notification

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

    

kgoofori / widepay-sms-notification example snippets


'connections' => [
    ....
    'widepay_sms' => [
            'id' => env('WIDEPAY_ID', ''),
            'key' => env('WIDEPAY_KEY', ''),
        ]
    ...
]

...
use NotificationChannels\WidepaySms\WidepaySmsChannel;
use NotificationChannels\WidepaySms\WidepaySmsMessage;

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

    public function toWidepaySms($notifiable)
    {
        return (new WidepaySmsMessage)
            ->sender('WidepaySms')
            ->message('Testing message')
            ->recipient('23324XXXXXXX'); //optional if routeNotificationForWidepaySms() is set on notifiable model
    }
}

class User extends Authenticatable
{
    use Notifiable;

    ....

    /**
     * Specifies the user's phone
     *
     * @return string
     */
    public function routeNotificationForWidepaySms()
    {
        return $this->phone;
    }
}

$user->notify(new AccountActivated);