cromwell/slacker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cromwell/slacker

Composer 安装命令:

composer require cromwell/slacker

包简介

Slack notifier

关键字:

README 文档

README

A quick Slack notifier for PHP

Simplified usage

<?php

require __DIR__ . '/vendor/autoload.php';

// setup with a configured Guzzle client
$slacker = new \Slacker\Slack(
    $config['webhook'],
    new \GuzzleHttp\Client()
);

// or with a default Guzzle client you need not pass it in
$slacker = new \Slacker\Slack($config['webhook']);

$slacker
    ->channel('#general')
    ->username('Slacker')
    ->message('Hello, #general')
    ->send();

// Or simpler, using the defaults chosen for the webook within Slack:
$slacker->message('Hello!')->send();

Calls to channel or username persist across uses, whereas calls to message reset the message and the attachment.

Regular usage

<?php

require __DIR__ . '/vendor/autoload.php';

$config = require(__DIR__ . '/slack-config.php');

// general setup
$slackPoster = new \Slacker\SlackPoster(
    new \GuzzleHttp\Client(),
    $config['hookUri']
);

$payload = new \Slacker\Payload\Payload();
$payload->username = $config['username'];
$payload->channel = $config['channel'];

// specific message setup
$payload->text = 'General Message Text';

$attachment = new \Slacker\Payload\Attachment();
$attachment->color = 'good';
$attachment->fallback = 'some fallback message';

$field = new \Slacker\Payload\Field();
$field->short = 'Field Short Message';
$field->title = 'Field Title';
$field->value = 'Field Value';
$attachment->addField($field);

$field = new \Slacker\Payload\Field();
$field->short = 'Field Short Message 2';
$field->title = 'Field Title 2';
$field->value = 'Field Value 2';
$attachment->addField($field);

$field = new \Slacker\Payload\Field();
$field->short = 'Field Short Message 3';
$field->title = 'Field Title 3';
$field->value = 'Field Value 3';
$attachment->addField($field);

$payload->addAttachment($attachment);

// send the message
$slackPoster->send($payload);

统计信息

  • 总下载量: 94
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固