PHP code example of shipper / laravel-winsms-channel

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

    

shipper / laravel-winsms-channel example snippets



// file: config/winsms.php

return [
    'api_key' => env('WINSMS_API_KEY', ''),
    'sender_id' => env('WINSMS_SENDER_ID', ''),
];

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Shipper\WinSMS\WinSMSChannel;
use Shipper\WinSMS\WinSMSMessage;

class ConfirmationNotification extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [WinSMSChannel::class];
    }

    // ...others method here


     /**
     * Send sms using WinSMS API
     *
     * @param mixed $notifiable
     * @return array
     */
    public function toWinSMS($notifiable):WinSMSMessage
    {
        return (new WinSMSMessage())
            ->to($notifiable->phone_number)
            ->from('MyApp')
            ->content('Your account has been created successfully');
    }
}

use Shipper\WinSMS\Facades\WinSMS;

WinSMS::sendSMS('216XXXXXXXX', 'MyApp', 'Your account has been created successfully');
bash
php  artisan vendor:publish --provider="Shipper\WinSMS\WinSMSServiceProvider"