nixilla / hipchat-bundle

提供简单的Hipchat通知服务 - 需要 Buzz

0.1.1 2017-03-30 12:08 UTC

This package is auto-updated.

Last update: 2024-09-19 00:13:04 UTC


README

非常基本和简单的Hipchat集成。目前它只提供单个房间的通知。但如果您想扩展它,请随时发送pull request。

Build Status Coverage Status

安装

使用composer安装

composer require nixilla/hipchat-bundle

将bundle添加到AppKernel

<?php

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // other bundles here,
            new Nixilla\HipchatBundle\NixillaHipchatBundle()
        ];
        
        return $bundles;
    }
}

配置parameters.yml

hipchat.token: tbc
hipchat.room: tbc
hipchat.domain: tbc

使用方法

将Hipchat服务注入到您的服务中

your.service:
    class: \YourClass
    arguments: [ "@hipchat.notifier" ]

在您的类中使用

<?php

class YourClass
{
    private $hipchat; // inject it via constructor
    
    public function yourMethod()
    {
        $this->hipchat->notify($colour = 'red', $message = 'Hello', $format = 'text', $notify = false);        
    }
}