stiko / hipchat-laravel
此包的最新版本(0.1.11)没有可用的许可证信息。
laravel项目的简单hipchat通知。
0.1.11
2017-07-25 00:59 UTC
Requires
- php: >=5.3.0
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2024-09-29 03:41:48 UTC
README
laravel/Lumen的简单hipchat通知
Laravel安装
- 需要composer
composer require stiko/hipchat-laravel
- 将ServiceProvider添加到
app/config/app.php
...
'providers' => [
...
HipchatNotification\HipchatLaravelServiceProvider::class,
],
- 发布
php artisan vendor:publish --provider="HipchatNotification\HipchatLaravelServiceProvider"
- 最后,将环境变量添加到
.env文件中
HIPCHAT_TOKEN=YourTokenhere
HIPCHAT_URL=YourhipchatUrlHere
Lumen安装
- 需要composer
composer require stiko/hipchat-laravel
- 将ServiceProvider添加到
bootstrap/app.php
...
//Hipchat provider
$app->register('HipchatNotification\HipchatLaravelServiceProvider');
-
将
src/config/hipchat.php复制到config/hipchat.php -
最后,将环境变量添加到
.env文件中
HIPCHAT_TOKEN=YourTokenhere
HIPCHAT_URL=YourhipchatUrlHere
获取令牌
- 登录到 Hipchat
- 点击
集成 - 选择您的房间,然后点击
创建自己的集成 - 在
向此房间发送消息部分,您可以找到您的url和tokenHipchat url和token
使用方法
- 开始的最简单方法是
use HipchatNotification\Hipchat;
...
$hipchat = new Hipchat();
$hipchat->send();
这将使用默认设置向房间发送消息。
- 要更改消息
$hipchat = new Hipchat();
$hipchat->message('your messsage here');
$hipchat->send();
- 允许的消息格式为html,text(默认)
$hipchat = new Hipchat();
$hipchat->messageformat('html');
$hipchat->send();
- 要关闭房间通知(默认开启)
$hipchat = new Hipchat();
$hipchat->notify(false);
$hipchat->send();
- 要更改颜色,允许的颜色有(黄色,绿色(默认),红色,紫色,灰色,随机)
$hipchat = new Hipchat();
$hipchat->color(green);
$hipchat->send();
- 或者您也可以提供一个完整的选项数组
$hipchat = new Hipchat();
$hipchat->options(
array(
'color' => 'green',
'message' => 'Your message',
'notify' => true,
'message_format' => 'text',
)
);
$hipchat->send();