PHP code example of parhamafkar / laravel-mattermost

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

    

parhamafkar / laravel-mattermost example snippets


'mattermost' => [
    'driver' => 'custom',
    'via' => ParhamAfkar\MattermostLogger\LogChannel::class,
    'level' => env('MATTERMOST_LOG_LEVEL', 'debug'),
    'channel' => env('MATTERMOST_CHANNEL', 'town-square'),
    'type' => env('MATTERMOST_TYPE', 'bot'),
],

'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'mattermost'],
],

Mattermost::send('Hello from Laravel!');
Mattermost::channel('errors')->send('Error message', [
    'user_id' => 1,
]);

Log::channel('mattermost')->info('User logged in', [
    'channel' => 'user-activity',
]);

Mattermost::send(string $message, array $context = []);
Mattermost::channel(string $channel)->send(string $message, array $context = []);
Mattermost::type('webhook')->send(string $message, array $context = []);
bash
php artisan vendor:publish --tag=mattermost-config
bash
php artisan mattermost:test
php artisan mattermost:test --channel=errors
php artisan mattermost:channels