lygav/php-slackbot
Composer 安装命令:
composer require lygav/php-slackbot
包简介
Simple, easy to use, PHP package for sending messages to Slack. Send pretty, colourful messages with rich attachments quickly with this friendly API
关键字:
README 文档
README
Simple, easy to use, PHP package for sending messages to Slack.
Send pretty, colourful messages with rich attachments quickly with this friendly API.
Compatible with PHP >= 5.3
Installation
Via composer
"require": { "lygav/php-slackbot": "0.0.*" }
Without composer, via PHAR
From the command line, enter into the cloned repository dir and run:
php makephar
You will see that a new file was created named "phpslackbot.phar". Then in your application:
include 'path/to/phpslackbot.phar';
The rest is the same as when installed with 'composer'
Your first message
$bot = new Slackbot("https://hooks.slack.com/services/your/incoming/hook"); $bot->text("Hi")->send();
Direct messages
$bot->text("Hi all!") ->from("username") ->toChannel("mychannel") ->send();
Create pretty, colorful attachments easily
$bot->attach( $bot->buildAttachment("fallback text") ->enableMarkdown() ->setText("We can have *mrkdwn* `code` _italic_ also in attachments") ) ->toGroup("mygroup") ->send();
Customise freely
$attachment = $bot->buildAttachment("fallback text"/* mandatory by slack */) ->setPretext("pretext line") ->setText("attachment body text") /* Human web-safe colors automatically translated into HEX equivalent */ ->setColor("lightblue") ->setAuthor("me") ->addField("short field", "i'm inline", TRUE) ->addField("short field 2", "i'm also inline", TRUE) ->setImageUrl("http://my-website.com/path/to/image.jpg"); $bot->attach($attachment)->send();
Set/ Override every possible setting
$options = array( 'username' => 'my-bot-name', 'icon_emoji' => ':icon name:', 'icon_url' => 'http://someicon.com', 'channel' => '#test-channel' ); $bot = new Slackbot($url, $options); $bot->text("check out bot new icon")->send(); // Choose to override 'last minute' (ex. when dealing with multiple consequtive messages) $bot->text("check out bot new icon")->send(array("username" => "other-bot-name"));
Advanced Usage
Use custom transfer handlers
$handler = new MockHandler(); $bot = new SlackBot($url, ['handler' => $handler]); $bot->text("some text") ->from("my-test-bot") ->toGroup("bot-testing") ->send();
lygav/php-slackbot 适用场景与选型建议
lygav/php-slackbot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 414.56k 次下载、GitHub Stars 达 39, 最近一次更新时间为 2015 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「slack」 「slackbot」 「php-slackbot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lygav/php-slackbot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lygav/php-slackbot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lygav/php-slackbot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple Symfony 3 and 4 Bundle for sending customizeable messages to Slack via incoming webhooks
A Highly Opinionated Symfony3/4 Deployer Recipe
This bundle provides integration with the Slack API library, allowing you to interact with the Slack API from within your Symfony projects
Wrapper for Slack Web API
This is my package support-tickets-notifications
Console commands
统计信息
- 总下载量: 414.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 39
- 点击次数: 25
- 依赖项目数: 2
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-02