PHP code example of kopitar / laravel-teams-logger

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

    

kopitar / laravel-teams-logger example snippets


'teams' => [
    'driver'  => 'custom',
    'via'     => \Kopitar\LaravelTeamsLogger\TeamsLoggerFactory::class,
    'level'   => 'debug',
    'url'     => env('TEAMS_WEBHOOK_URL')
],

Log::channel('teams')->info('Neque porro quisquam est qui dolorem!');

Log::channel('teams')->debug('Neque porro quisquam est qui dolorem!');

Log::channel('teams')->info('{"text":"Neque porro quisquam est qui dolorem!","themeColor":"#df0087"}');

Log::channel('teams')->info(
    'Neque porro quisquam est qui dolorem!', ['type' => 'card']
);

Log::channel('teams')->debug(
    'Neque porro **quisquam** est qui dolorem! [Markdown disabled](http://example.net)',
    [
        'type' => 'card',
        'title' => 'Alternative title',
        'themeColor' => '#0000ff',
        'avatar' => false,
        'markdown' => false
    ]
);

Log::channel('teams')->debug('Neque porro **quisquam** est qui dolorem!', ['themeColor' => '#0000ff']);

Log::channel('teams')->critical(
    'Neque porro quisquam est qui dolorem!',
    [
        'type' => 'card',
        'facts' => [
            'happened at' => now()->toDayDateTimeString(),
            'file' => __FILE__,
            'severity' => 'Critical'
        ],
    ]
);

        Log::channel('teams')->info("Neque porro quisquam est qui dolorem!", [
           'type' => 'card',
           'actions' => [[
                '@type' => 'ActionCard',
                'name' => 'Add a comment',
                'inputs' => [
                    [
                        '@type' => 'TextInput',
                        'id' => 'comment',
                        'isMultiline' => false,
                        'title' => 'Add a comment here for this task'
                    ]
                ],
                'actions' => [
                    [
                        '@type' => 'HttpPOST',
                        'name' => 'Add comment',
                        'target' => 'https =>//learn.microsoft.com/outlook/actionable-messages'
                    ]
                ],
            ]]
        ]);
bash
$ php artisan vendor:publish --tag=teams