PHP code example of meshgroup / megafon-notification-channel

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

    

meshgroup / megafon-notification-channel example snippets


// config/app.php
'providers' => [
    ...
    Meshgroup\Megafon\MegafonServiceProvider::class,
],

// config/services.php
...
'megafon' => [
    'login'  => env('MEGAFON_LOGIN'),
    'password' => env('MEGAFON_PASSWORD'),
    'sender' => 'John_Doe'
],
...

// config/services.php
...
'megafon' => [
    ...
    'host' => env('MEGAFON_HOST'),
    ...
],
...

use Illuminate\Notifications\Notification;
use Meshgroup\Megafon\MegafonMessage;
use Meshgroup\Megafon\MegafonChannel;

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

    public function toMegafon($notifiable)
    {
        return MegafonMessage::create("Task #{$notifiable->id} is complete!");
    }
}

public function routeNotificationForMegafon()
{
    return $this->phone;
}