PHP code example of ol-zamovshafu / devinotelecom-laravel

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

    

ol-zamovshafu / devinotelecom-laravel example snippets


/*
 * Package Service Providers...
 */

NotificationChannels\Devinotelecom\DevinotelecomSmsServiceProvider::class,

'DevinotelecomSms' => NotificationChannels\Devinotelecom\DevinotelecomSms::class,

...
    'DevinotelecomSms' => [
        'client'     => 'http',
        'http'       => [
            'endpoint' => 'https://integrationapi.net/rest/',
        ],
        'login'   => '',
        'password'   => '',
        'originator' => '', // Sender name.
        'timeout'    => 60,
    ],
...

use NotificationChannels\Devinotelecom\DevinotelecomSmsChannel;
use Zamovshafu\Devinotelecom\ShortMessage;

class ResetPasswordWasRequested extends Notification
{
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [DevinotelecomSmsChannel::class];
    }
    
    /**
     * Get the DevinotelecomSms representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return string|\Zamovshafu\Devinotelecom\ShortMessage
     */
    public function toDevinotelecomSms($notifiable) {
        return "Test notification";
        // Or
        return new ShortMessage($notifiable->phone_number, 'Test notification');
    }
}

class User extends Authenticatable
{
    use Notifiable;
 
    public function routeNotificationForDevinotelecomSms()
    {
        return "905123456789";
    }
}

DevinotelecomSms::sendShortMessage($to, $message);

namespace App\Listeners;

use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use NotificationChannels\Devinotelecom\Events\MessageWasSent;

class SentMessageHandler
{
    /**
     * Handle the event.
     *
     * @param  MessageWasSent  $event
     * @return void
     */
    public function handle(MessageWasSent $event)
    {
        $response = $event->response;
        $message = $event->message;
    }
}