rhincodon/gitter-api

PHP package for interaction with Gitter REST API.

1.0.2 2015-09-21 02:40 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:49:31 UTC


README

PHP package for interaction with Gitter REST API.

Latest Version on Packagist Software License Build Status Total Downloads

Install

Via Composer

$ composer require rhincodon/gitter-api

Usage

// Get new gitter instance
$gitter = new GitterApi($token);

// You can change token
$gitter->setToken($token);

// List of rooms for current user
$rooms = $gitter->rooms();

// Get room or join
$room = $gitter->room($roomId|$roomUrl);

// List of room users
$roomUsers = $room->users();

// List of room channels
$roomChannels = $room->channels();

// List of room messages
$roomMessages = $room->messages()->skip(10)->take(5)->before($messageId|$message)->after($messageId|$message)->get();

// Send message to the room
$message = $room->sendMessage($text);

// Update sent message
$message->update($text);

// Get message author
$messageAuthor = $message->author();

// Get message mentioned users
$messageMentions = $message->mentions();

// Get current user
$currentUser = $gitter->currentUser();

// Current user resources
$userRooms = $currentUser->rooms();
$userOrgs = $currentUser->organizations();
$userRepos = $currentUser->repositories();
$userChannels = $currentUser->channels();

Contributing

Please see CONTRIBUTING for details.

Testing

Set up gitter token in .env file and run:

$ composer test

License

The MIT License (MIT). Please see License File for more information.