PHP code example of indielab / yii2-slack

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

    

indielab / yii2-slack example snippets


'components' => [
    // ...
    'slack' => [
        'class' => 'Indielab\Slack\Client',
        'token' => 'xoxp-1234567891-1234567891-1234567891',
        'channel' => 'indielab',
        'username' => 'Slack Bot',
    ]
]

Yii::$app->slack->message('Just a Message')->send();

Yii::$app->slack->danger('Very dangerous!')->send();