2017 © Pedro Peláez
 

library zf-snap-hip-chat

HipChat module (api and logger) for Zend Framework 2

image

snapshotpl/zf-snap-hip-chat

HipChat module (api and logger) for Zend Framework 2

  • Saturday, February 11, 2017
  • by snapshotpl
  • Repository
  • 2 Watchers
  • 3 Stars
  • 5,915 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

ZfSnapHipChat

HipChat module for Zend Framework 2, (*1)

Module helps to use HipChat API and log messages to yours rooms!, (*2)

The simplest usage

Add auth token (you can create it here - remember to set type admin) to your config:, (*3)

return array(
  'zf_snap_hip_chat' => array(
    'api' => array(
      'auth_token' => 'yourauthtoken',
    ),
  ),
);

And then get HipChat API object from Service Manager:, (*4)

$hipChat = $this->getServiceLocator()->get('hipchat');

That's all! Module uses official HipChat library for PHP., (*5)

How to install?

Via composer.json, (*6)

{
  "require": {
    "snapshotpl/zf-snap-hip-chat": "1.*"
  }
}

and add module ZfSnapHipChat to application.config.php., (*7)

Use HipChat as logger

To use HipChat as logger, you need to set room ID (IDs) or name (names) in config:, (*8)

return array(
  'zf_snap_hip_chat' => array(
    'logger' => array(
      'room_id' => array(100001, 'log room'),
    ),
  ),
);

Now you have access to log writer from service manager:, (*9)

$logger = new Zend\Log\Logger();
$hipChat = $this->getServiceLocator()->get('hipchat_log_writer');
$logger->addWriter($hipChat);
$logger->debug('HipChat debug message!');

...or logger:, (*10)

$logger = $this->getServiceLocator()->get('hipchat_logger');
$logger->debug('HipChat debug message!');

Options

You can customize logger using config:, (*11)

return array(
  'zf_snap_hip_chat' => array(
    'api' => array(
      'auth_token' => null, // Required auth token
      'api_target' => HipChat::DEFAULT_TARGET, // Url address to HipChat API
      'api_version' => HipChat::VERSION_1, // Api version
    ),
    'logger' => array(
      'room_id' => null, // string, int or array with IDs, required for logger
      'from' => 'ZfSnapHipChat', // Author name for log messages in your rooms
      'notify' => false, // Enables sounds notify in HipChat
      'format' => HipChat::FORMAT_HTML, // Message format
    ),
  ),
);

Console usage

You can manipulate HipChat API from application console. To get list of commands write in console:, (*12)

php public/index.php
HipChat API
  index.php hipchat message send <message> [--room=] [--from=] [--notify] [--color=(yellow|red|gray|green|purple|random)] [--format=(html|text)]    Sends message
  index.php hipchat room list    Lists rooms
  index.php hipchat room history <room> [--date=]    Room's history                           
  index.php hipchat room set topic <room> <topic> [--from=]    Sets room topic

The Versions

11/02 2017

dev-refresh-module

dev-refresh-module

HipChat module (api and logger) for Zend Framework 2

  Sources   Download

The Requires

 

logger log zf2 hipchat

02/03 2014

dev-master

9999999-dev

HipChat module (api and logger) for Zend Framework 2

  Sources   Download

The Requires

 

logger log zf2 hipchat

02/03 2014

1.1

1.1.0.0

HipChat module (api and logger) for Zend Framework 2

  Sources   Download

The Requires

 

logger log zf2 hipchat

02/03 2014

1.0

1.0.0.0

Hip Chat Module for Zend Framework 2

  Sources   Download

The Requires

 

logger log zf2 hipchat