Skip to content

Commit

Permalink
Merge pull request #4 from dshimy/master
Browse files Browse the repository at this point in the history
Added composer support.
  • Loading branch information
powdahound committed Aug 9, 2012
2 parents f6944b2 + 61cff90 commit 2fca974
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 22 deletions.
51 changes: 30 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
hipchat-php
===========
# hipchat-php

A PHP library for interacting with the [HipChat][hc] REST API.
A PHP library for interacting with the [HipChat](http://hipchat.com) REST API.

Testing
-------
You can test this library (and your API key) using the example.php script as follows. It should print a list of your rooms and users.
## Composer Installation

./example.php <your api token>
HipChat-PHP can be installed with Composer (http://getcomposer.org/). Add the following to your
composer.json file. Composer will handle the autoloading.

To test the library itself, run the PHPUnit tests:
```json
{
"require": {
"hipchat/hipchat-php": ">=1.0.0"
}
}
```

phpunit tests/
## Usage

Usage
-----
require 'HipChat.php';
```php
$token = '<your api token>';
$hc = new HipChat\HipChat($token);

$token = '<your api token>';
$hc = new HipChat($token);
// list rooms
foreach ($hc->get_rooms() as $room) {
echo " - $room->room_id = $room->name\n";
}

// list rooms
foreach ($hc->get_rooms() as $room) {
echo " - $room->room_id = $room->name\n";
}
// send a message to the 'Development' room from 'API'
$hc->message_room('Development', 'API', 'This is just a test message!');
```

// send a message to the 'Development' room from 'API'
$hc->message_room('Development', 'API', 'This is just a test message!');
## Testing

You can test this library (and your API key) using the example.php script as follows. It should print a list of your rooms and users.

./example.php <your api token>

[hc]: http://www.hipchat.com
To test the library itself, run the PHPUnit tests:

phpunit tests/
16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "hipchat/hipchat-php",
"type": "library",
"description": "PHP Library for HipChat",
"keywords": ["hipchat"],
"homepage": "http://github.com/hipchat/hipchat-php",
"license": "MIT",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {
"HipChat": "src"
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/HipChatPHPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* TODO: Test valid requests. What API token to use?
*/

require_once dirname(__FILE__).'/../HipChat.php';
require_once dirname(__FILE__).'/../src/HipChat/HipChat.php';
require_once 'PHPUnit/Framework.php';

class HipChatPHPTest extends PHPUnit_Framework_TestCase {
Expand Down

0 comments on commit 2fca974

Please sign in to comment.