2017 © Pedro Peláez
 

library hipchat

A notifier class for Hipchat notifications

image

hannesvdvreken/hipchat

A notifier class for Hipchat notifications

  • Tuesday, February 3, 2015
  • by hannesvdvreken
  • Repository
  • 1 Watchers
  • 13 Stars
  • 3,013 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Hipchat notifier

Build Status Latest Stable Version Total Downloads, (*1)

Usage

Getting started with a Hello World example., (*2)

// Configuration.
$rooms = [
    [
        'room_id' => '1234',
        'auth_token' => '****',
    ],
];

// Create the required Guzzle client.
$client = new Guzzle\Http\Client;
$hipchat = new Hipchat\Notifier($client, $rooms);

// Send the notification.
$hipchat->notify('Hello world!');

If you would like to send notification to different rooms, add some to the array., (*3)

// Configuration.
$rooms = [
    'frontenders' => [
        'room_id' => '1234',
        'auth_token' => '****',
    ],
    'backenders' => [
        'room_id' => '5678',
        'auth_token' => '****',
    ],
];

// Create the required Guzzle client.
$client = new Guzzle\Http\Client;
$hipchat = new Hipchat\Notifier($client, $rooms);

// Send the notification.
$hipchat->notifyIn('frontenders', 'Hello world!');

The default room in which the notify method posts to is the first from the array, or you can specify which room to use as a default with a third constructor parameter:, (*4)

Extra configuration.

The constructor accepts a third parameter with extra options., (*5)

$config = [
    'default' => 'frontenders',
    'color' => 'gray',
    'pretend' => true,
    'notify' => true,
];
  • default: The default room to send notifications in with ->notify().
  • color: Choose from yellow, red, green, purple, gray or random.
  • pretend: Don't actually send any messages.
  • notify: Let hipchat make a sound.

Color

Choose your color depending on the type of message with the second and third parameter of the notify and notifyIn method., (*6)

// Example 1
$color = $error ? 'red' : 'green';
$hipchat->notify($message, $color);

// Example 2
$hipchat->notifyIn('frontenders', $message, 'purple');

Laravel 4

This package comes with a Laravel 4 service provider. Add the following line to the providers array in app.php., (*7)

'Hipchat\Support\ServiceProvider',

It also registers an alias for the Facade class Hipchat\Support\Facades\Hipchat so you can just use Hipchat::notify($message) and Hipchat::notifyIn('frontenders', $message)., (*8)

Publish the default configuration with the following command:, (*9)

php artisan config:publish hannesvdvreken/hipchat

All configurable options can be found there., (*10)

Contributing

Feel free to make a pull request. Please try to be as PSR-2 compliant as possible., (*11)

License

MIT, (*12)

The Versions

03/02 2015

dev-master

9999999-dev

A notifier class for Hipchat notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel hipchat serviceprovider nofication rooms

31/12 2014

dev-develop

dev-develop

A notifier class for Hipchat notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel hipchat serviceprovider nofication rooms

26/01 2014

v0.1.0

0.1.0.0

A notifier class for Hipchat notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel hipchat serviceprovider nofication rooms