2017 © Pedro Peláez
 

yii2-extension yii2-slack

Yii2 slack client based library

image

ambikuk/yii2-slack

Yii2 slack client based library

  • Thursday, July 27, 2017
  • by ambikuk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Yii2 Slack integration

Installation

add, (*1)

"ambikuk/yii2-slack": "*"

to the require section of your composer.json file., (*2)

this extension just wrapper to https://github.com/maknz/slack, (*3)

Also, you should configure incoming webhook inside your Slack team., (*4)

Usage

Configure component:, (*5)

...
    'components' => [
        'slack' => [
            'class' => 'ambikuk\yiislack\Slack',
            'url' => '<slack incoming webhook url here>',
            'username' => 'Slack Bot',
            'channel' => '#channel'
        ],
    ],
...

Now you can send messages right into slack channel via next command:, (*6)

Yii::$app->slack->send('New alert from the monitoring system', [
    'fallback' => 'Current server stats',
    'text' => 'Current server stats',
    'color' => 'danger',
    'fields' => [
        [
          'title' => 'CPU usage',
          'value' => '90%',
          'short' => true // whether the field is short enough to sit side-by-side other fields, defaults to false
        ],
        [
          'title' => 'RAM usage',
          'value' => '2.5GB of 4GB',
          'short' => true
        ]
    ]
]);

Use custom settings, (*7)

$slack = Yii::$app->slack;
$slack->setSetting([
    'username' => 'Jack',
    'channel' => '#mychannel'
]);
$slack->send('Are we rich yet?');

Use Maknz\Slack\Client functions, (*8)

$slack = Yii::$app->slack->getClient();
$slack->to('@username')->send('Yo!');

The Versions

27/07 2017

dev-master

9999999-dev

Yii2 slack client based library

  Sources   Download

GPL-3.0

The Requires

 

extension yii2 slack

27/07 2017

0.1.0

0.1.0.0

Yii2 slack client based library

  Sources   Download

GPL-3.0

The Requires

 

extension yii2 slack