PHP code example of undjike / ekosms-laravel-notification-channel

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

    

undjike / ekosms-laravel-notification-channel example snippets




return [
    //...

    'ekosms' => [
        'username' => env('EKOSMS_USERNAME'), // You can type in directly your credentials 
        'password' => env('EKOSMS_PASSWORD')
    ],
];



namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Undjike\EkoSmsNotificationChannel\EkoSmsChannel;
use Undjike\EkoSmsNotificationChannel\EkoSmsMessage;

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

    /**
     * @param $notifiable
     * @return mixed
     */
    public function toEkoSms($notifiable)
    {
        return EkoSmsMessage::create()
            ->body('Type here you message content...')
            ->sender('Brand name');
        // or return 'Type here you message content...';
    }
}


    /**
     * Attribute to use when addressing EkoSMS notification
     *
     * @returns string|array
     */
    public function routeNotificationForEkoSms()
    {
        return $this->phone_number; // Can be a string or an array of valid phone numbers
    }