nexylan/slack-bundle
Composer 安装命令:
composer require nexylan/slack-bundle
包简介
Symfony bundle integration of nexylan/slack library
README 文档
README
Symfony bundle integration of the nexylan/slack library (old popular maknz/slack).
Documentation
All the installation and usage instructions are located in this README. Check it for specific version:
Prerequisites
This version of the project requires:
- PHP 7.1+
- Symfony 3.4+
Installation
First of all, you need to require this library through composer:
$ composer require nexylan/slack-bundle php-http/guzzle6-adapter
Why php-http/guzzle6-adapter? We are decoupled from any HTTP messaging client thanks to HTTPlug.
Then, enable the bundle on the AppKernel class:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Http\HttplugBundle\HttplugBundle(), new Nexy\SlackBundle\NexySlackBundle(), ); // ... return $bundles }
Configuration
If it is not already done, you have to configure httplug-bundle first. Check the official documentation for this.
Configure the bundle to your needs (example with default values):
nexy_slack: # If you want to use an another httplug client service. http: client: httplug.client # The Slack API Incoming WebHooks URL. endpoint: ~ # Required channel: null username: null icon: null link_names: false unfurl_links: false unfurl_media: true allow_markdown: true markdown_in_attachments: []
Excepted endpoint, all the other configuration keys are related to the Slack client default settings.
All those settings are described on the nexylan/slack documentation.
Usage
The Slack client instance can be retrieved from the nexy_slack.client service.
Here is an example:
<?php namespace AppBundle\Controller; use Nexy\Slack\Attachment; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction() { $slack = $this->get('nexy_slack.client'); $message = $slack->createMessage(); $message ->to('#test') ->from('John Doe') ->withIcon(':ghost:') ->setText('This is an amazing message!') ; $message->attach((new Attachment()) ->setFallback('Some fallback text') ->setText('The attachment text') ); $slack->sendMessage($message); } }
All the how to manipulate the Slack client is on the nexylan/slack documentation.
nexylan/slack-bundle 适用场景与选型建议
nexylan/slack-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.2M 次下载、GitHub Stars 达 107, 最近一次更新时间为 2016 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nexylan/slack-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nexylan/slack-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.2M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 107
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 8
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-03