displayce / slack-bundle
此包提供了与 Slack API 库的集成,允许您在 Symfony 项目中与 Slack API 进行交互
0.23.0
2020-08-23 16:22 UTC
Requires
- php: >=5.5
- displayce/slack: ^0.23
- symfony/framework-bundle: ^2.3|^3.0|^4.0|^5.0
Requires (Dev)
- dev-master
- 0.23.0
- 0.22.3
- 0.22.2
- 0.22.1
- 0.21.1
- 0.21.0
- 0.20.1
- 0.18.1
- 0.15.4
- 0.15.3
- 0.15.2
- 0.15.1
- 0.14.2
- 0.14.1
- 0.13.2
- 0.13.1
- 0.12.1
- 0.11.1
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.6.1
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.8.2
- 0.8.1
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
- dev-catching-up
- dev-refactored-due-to-factory-removal
- dev-preparing-for-0.12
This package is not auto-updated.
Last update: 2024-09-16 11:48:45 UTC
README
Symfony 扩展,通过提供易于使用的服务和配置,将 Slack API 客户端集成到项目中。
如果您想从命令行访问 Slack Web API,请考虑安装slack-cli 包。
快速示例
以下是如何使用 API 的 chat.postMessage
方法向 Slack 中的一个频道发送消息的示例
<?php // Acme\DemoBundle\Controller\MySlackController public function sendAction() { $payload = new ChatPostMessagePayload(); $payload->setChannel('#general'); // Channel names must begin with a hash-sign '#' $payload->setText('Hello world!'); // also supports Slack formatting $payload->setUsername('acme'); // can be anything you want $payload->setIconEmoji('birthday'); // check out emoji.list-payload for a list of available emojis $response = $this->get('cl_slack.api_client')->send($payload); // display the Slack channel ID on which the message was posted echo $response->getChannel(); // would return something like 'C01234567' // display the Slack timestamp on which the message was posted (note: NON-unix timestamp!) echo $response->getTimestamp(); // would return something like '1407190762.000000' }
在 Slack 中,这将在 #general
频道中得到类似的结果:
更多示例可以在使用文档中找到。
文档
关于如何访问每个 API 方法的详细文档可以在集成此扩展的包的文档中找到: Slack API 库
感谢
贡献
如果您想为此包做出贡献,请查看贡献文档。