mremi / flowdock
一个用于与 Flowdock API 交互的 PHP 库
v1.0.0
2015-01-08 21:03 UTC
Requires
- php: >=5.3.3
- guzzle/guzzle: ~3.7
- symfony/console: ~2.5
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is auto-updated.
Last update: 2024-09-18 03:42:51 UTC
README
此库允许您与Flowdock API 交互。
基本文档
安装
仅需一步
使用 composer 下载 Flowdock
在 composer.json 中添加 Flowdock
{ "require": { "mremi/flowdock": "dev-master" } }
现在运行以下命令让 composer 下载库
$ php composer.phar update mremi/flowdock
Composer 会将库安装到项目的 vendor/mremi
目录。
推送 API
聊天
<?php use Mremi\Flowdock\Api\Push\ChatMessage; use Mremi\Flowdock\Api\Push\Push; $message = ChatMessage::create() ->setContent('This message has been sent with mremi/flowdock PHP library') ->setExternalUserName('mremi') ->addTag('#hello-world'); $push = new Push('your_flow_api_token'); if (!$push->sendChatMessage($message, array('connect_timeout' => 1, 'timeout' => 1))) { // handle errors... $message->getResponseErrors(); }
您也可以在控制台中操作,查看帮助信息
$ bin/flowdock send-chat-message --help
一些参数是必需的
$ bin/flowdock send-chat-message your_flow_api_token "This message has been sent with mremi/flowdock PHP library" mremi
一些选项是可用的
$ bin/flowdock send-chat-message your_flow_api_token "This message has been sent with mremi/flowdock PHP library" mremi --message-id=12 --tags="#hello" --tags="#world" --options='{"connect_timeout":1,"timeout":1}'
团队收件箱
<?php use Mremi\Flowdock\Api\Push\Push; use Mremi\Flowdock\Api\Push\TeamInboxMessage; $message = TeamInboxMessage::create() ->setSource('source') ->setFromAddress('from.mremi@test.com') ->setSubject('subject') ->setContent('This message has been sent with mremi/flowdock PHP library'); $push = new Push('your_flow_api_token'); if (!$push->sendTeamInboxMessage($message, array('connect_timeout' => 1, 'timeout' => 1))) { // handle errors... $message->getResponseErrors(); }
您也可以在控制台中操作,查看帮助信息
$ bin/flowdock send-team-inbox-message --help
一些参数是必需的
$ bin/flowdock send-team-inbox-message your_flow_api_token source "from.mremi@test.com" subject "This message has been sent with mremi/flowdock PHP library"
一些选项是可用的
$ bin/flowdock send-team-inbox-message your_flow_api_token source "from.mremi@test.com" subject "This message has been sent with mremi/flowdock PHP library" --from-name=mremi --reply-to="to.mremi@test.com" --project=project --format=html --link="http://www.flowdock.com/" --tags="#hello" --tags="#world" --options='{"connect_timeout":1,"timeout":1}'
...更多功能即将推出...
贡献
有任何问题或反馈?请打开问题,我会尽快回复。
这里缺少某个功能?请随意创建 pull request 来解决它!
希望这对你有所帮助,如果你觉得有用,请分享和推荐! :)