stiko/hipchat-laravel

此包的最新版本(0.1.11)没有可用的许可证信息。

laravel项目的简单hipchat通知。

0.1.11 2017-07-25 00:59 UTC

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

获取令牌

  1. 登录到 Hipchat
  2. 点击集成
  3. 选择您的房间,然后点击创建自己的集成
  4. 向此房间发送消息部分,您可以找到您的urltoken Hipchat 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();