PHP code example of sky / yii2-slack-client

1. Go to this page and download the library: Download sky/yii2-slack-client 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/ */

    

sky / yii2-slack-client example snippets

t

$builder = Yii::$app->message->createBuilder();
// or 
$builder = new SlackBuilder();

// set text
$builder->setText('Hello World');

// add Blocks
$builder->addHeaderBlock(['text' => 'Helllo']);
$builder->addDividerBlock();

$sectionBlock = new SectionBlock(['text' => 'this is object block']);
$builder->addBlock($section);

// send builder
$builder->send();

// or
$builder->send(Yii::$app->message);

// or 
Yii::$app->message->sendBuilder($builder);

php composer.phar 

'log' => [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class' => 'sky\slack\SlackTarget',
            'levels' => ['error', 'warning'],
            'channel' => 'error',
        ],
    ],
],