linxlad/zephlack
Composer 安装命令:
composer require linxlad/zephlack
包简介
Slack Messenger extension written in Zephir.
README 文档
README
Slack Messaging extension written in Zephir.
Slack is a platform for team communication: everything in one place, instantly searchable, available wherever you go. You can find out more about Slack here.
Installation
Pre-built extension
Grab the latest extension from here and place it in the following directory:
######Ubuntu
/usr/lib/php5/20.../zephlack.so
######CentOS
/usr/lib64/php/modules/zephlack.so
Add extension to your php configuration:
extension=zephlack.so
#####Self build extension
(Zephir installation required for this option. Instructions can be found here)
git clone --depth=1 --branch=master https://github.com/linxlad/zephlack.git
cd zephlack
zephir build
Add extension to your php configuration:
extension=zephlack.so
Finally restart your web server.
Usage
Simple
$client = new Zephlack\Client('team', 'token'); $message = new Zephlack\Message\Message('This year you are on the good list'); $message->setChannel('#channel'); $message->setIconEmoji(':santa:'); $message->setUsername('Mr Claus'); $client->setDebug(false); /* WIll return bool or if debug is enabled will return the payload and response */ $client->notify($message);
With attachments
$client = new Zephlack\Client('team', 'token'); $message = new Zephlack\Message\Message('This year you are on the good list'); $attachment = new Zephlack\Message\MessageAttachment(); $field = new Zephlack\Message\MessageField(); $field ->setTitle('foo') ->setValue('bar'); $attachment->addField($field); $message->addAttachment($attachment); $message->setChannel('#channel'); $message->setIconEmoji(':santa:'); $message->setUsername('Mr Claus'); $client->notify($message);
Message
If your message contain @username and you want him to be notified, add $message->enableLinkNames(true)
Credits
I would like to credit:
Polem for the leg work on slack-notifier which this is based. Great PHP slack messaging package which can be found here slack-notifier.
Nirlah for the http utility that saved me hours of work. Again a great Zephir based package which can be found here Toolbelt.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-01-03