PHP code example of mediumart / notifier

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

    

mediumart / notifier example snippets


/**
 * Get the notification channels.
 *
 * @param  mixed  $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return ['twitter'];
}

Mediumart\Notifier\NotifierServiceProvider::class

/**
 * Check for the channel capacity.
 *
 * @param  string $driver
 * @return bool
 */
public static function canHandleNotification($driver)
{
    return in_array($driver, ['twitter']);
}

/**
 * Create a new driver instance.
 *
 * @param  $driver
 * @return mixed
 */
public static function createDriver($driver)
{
    return static::canHandleNotification($driver) 
        ? new static(App::make('someTwitterClient')) : null;
}

/**
* Notifications channels list.
*
* @var array
*/
public $notificationsChannels = [
    \Mediumart\Notifier\Channels\TwitterChannel::class,
];

$ php artisan notifier:channel <channel_class_name>