PHPackages                             serafim/gitter-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. serafim/gitter-api

ActiveLibrary[Queues &amp; Workers](/categories/queues)

serafim/gitter-api
==================

Gitter async api

4.0.8(7y ago)152261MITPHPPHP &gt;=7.0

Since Jan 25Pushed 7y ago2 watchersCompare

[ Source](https://github.com/SerafimArts/gitter-api)[ Packagist](https://packagist.org/packages/serafim/gitter-api)[ RSS](/packages/serafim-gitter-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (9)Versions (37)Used By (0)

Gitter API Client 4.0
=====================

[](#gitter-api-client-40)

[![Latest Stable Version](https://camo.githubusercontent.com/6f4c55b8a20e49a926dce26b855aa2a78a0d366edbdc6b21740c17fd986d6029/68747470733a2f2f706f7365722e707567782e6f72672f7365726166696d2f6769747465722d6170692f762f737461626c65)](https://packagist.org/packages/serafim/gitter-api)[![https://travis-ci.org/SerafimArts/gitter-api](https://camo.githubusercontent.com/6bba130f3185d4b5429961cfb35ef8211bb80ad9990cee3f1bf3735a18ca9f69/68747470733a2f2f7472617669732d63692e6f72672f5365726166696d417274732f6769747465722d6170692e737667)](https://travis-ci.org/SerafimArts/gitter-api/builds)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/55dcb26e4104875ec45a82507adeb664d8fff001aac7ac62e9ad0baf5b41c626/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5365726166696d417274732f6769747465722d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SerafimArts/gitter-api/?branch=master)[![License](https://camo.githubusercontent.com/2bcb0a948883993aec4d0b7d656f7b0c9486212dbc716afa65d06be4df46afef/68747470733a2f2f706f7365722e707567782e6f72672f7365726166696d2f6769747465722d6170692f6c6963656e7365)](https://packagist.org/packages/serafim/gitter-api)[![Total Downloads](https://camo.githubusercontent.com/bf24a8ab2d01709fb05d8c924bb97ba6e2ad8abc26cbab5b3498a316290b07a4/68747470733a2f2f706f7365722e707567782e6f72672f7365726166696d2f6769747465722d6170692f646f776e6c6f616473)](https://packagist.org/packages/serafim/gitter-api)

- [Version 3.0.x](https://github.com/SerafimArts/gitter-api/tree/5bf22f2b5bbc517600937fbbaa44037a89688a82)
- [Version 2.1.x](https://github.com/SerafimArts/gitter-api/tree/967ef646afa3181fbb10ec6669538c4911866731)
- [Version 2.0.x](https://github.com/SerafimArts/gitter-api/tree/8ad7f4d06c5f8196ada5798799cd8c1d5f55a974)
- [Version 1.1.x](https://github.com/SerafimArts/gitter-api/tree/26c3640a1d933db8ad27bd3c10f8bc42ff936c47)
- [Version 1.0.x](https://github.com/SerafimArts/gitter-api/tree/f955ade02128e868d494baf0acc021bc257c1807)

Installation
------------

[](#installation)

`composer require serafim/gitter-api`

Creating a Gitter Client
------------------------

[](#creating-a-gitter-client)

```
use Gitter\Client;

$client = new Client($token);
// OR
$client = new Client($token, $logger); // $logger are instance of \Psr\Log\LoggerInterface

// ... SOME ACTIONS ...

$client->connect(); // Locks current runtime and starts an EventLoop (for streaming requests)
```

Resources
---------

[](#resources)

```
// $client = new \Gitter\Client('token');

$client->groups;   // Groups resource (Traversable)
$client->messages; // Messages resource
$client->rooms;    // Rooms resource (Traversable)
$client->users;    // Users resource
```

### Example

[](#example)

```
foreach ($client->rooms as $room) {
    var_dump($room);
}
```

### Streaming

[](#streaming)

```
$observer = $client->rooms->messages('roomId'); // Observer

$observer->subscribe(function ($message) {
    var_dump($message);
});

// Connect to stream!
$client->connect();
```

Available resources
-------------------

[](#available-resources)

### Groups

[](#groups)

List groups the current user is in.

- `$client->groups->all(): array`

List of rooms nested under the specified group.

- `$client->groups->rooms(string $roomId): array`

### Messages

[](#messages)

List of messages in a room in historical reversed order.

- `$client->messages->all(string $roomId[, string $query]): \Generator`

There is also a way to retrieve a single message using its id.

- `$client->messages->find(string $roomId, string $messageId): array`

Send a message to a room.

- `$client->messages->create(string $roomId, string $content): array`

Update a message.

- `$client->messages->update(string $roomId, string $messageId, string $content): array`

Delete a message.

- `$client->messages->delete(string $roomId, string $messageId): array`

### Rooms

[](#rooms)

List rooms the current user is in.

- `$client->rooms->all([string $query]): array`

Join user into a room.

- `$client->rooms->joinUser(string $roomId, string $userId): array`

Join current user into a room.

- `$client->rooms->join(string $roomId): array`

Join current user into a room by room name (URI).

- `$client->rooms->joinByName(string $name): array`

Find room by room name (URI).

- `$client->rooms->findByName(string $name): array`

Kick user from target room.

- `$client->rooms->kick(string $roomId, string $userId): array`

This can be self-inflicted to leave the the room and remove room from your left menu.

- `$client->rooms->leave(string $roomId): array`

Sets up a new topic of target room.

- `$client->rooms->topic(string $roomId, string $topic): array`

Sets the room is indexed by search engines.

- `$client->rooms->searchIndex(string $roomId, bool $enabled): array`

Sets the tags that define the room

- `$client->rooms->tags(string $roomId, array $tags): array`

If you hate one of the rooms - you can destroy it!

- `$client->rooms->delete(string $roomId): array`

List of users currently in the room.

- `$client->rooms->users(string $roomId[, string $query]: \Generator`

Use the streaming API to listen events.

- `$client->rooms->events(string $roomId): Observer`

Use the streaming API to listen messages.

- `$client->rooms->messages(string $roomId): Observer`

### Users

[](#users)

Returns the current user logged in.

- `$client->users->current(): array`
- `$client->users->currentUserId(): string`

List of Rooms the user is part of.

- `$client->users->rooms([string $userId]): array`

You can retrieve unread items and mentions using the following endpoint.

- `$client->users->unreadItems(string $roomId[, string $userId]): array`

There is an additional endpoint nested under rooms that you can use to mark chat messages as read

- `$client->users->markAsRead(string $roomId, array $messageIds[, string $userId]): array`

List of the user's GitHub Organisations and their respective Room if available.

- `$client->users->orgs([string $userId]): array`

List of the user's GitHub Repositories and their respective Room if available.

- `$client->users->repos([string $userId]): array`

List of Gitter channels nested under the user.

- `$client->users->channels([string $userId]): array`

Custom WebHook Notifications
----------------------------

[](#custom-webhook-notifications)

Create a "Custom Webhook":

- Open your chat
- Click on "Room Settings" button
- Click on "Integrations"
- Select "Custom"
- Remember yor Hook Id, like `2b66cf4653faa342bbe8` inside `https://webhooks.gitter.im/e/` url.

```
$client->notify($hookId)
    // ->error($message) - Send "Error" message
    // ->info($message) - Send "Info" message
    // ->withLevel(...) - Sets up level
    ->send('Your message with markdown'); // Send message with markdown content
```

Custom routing
--------------

[](#custom-routing)

```
$route = Route::get('rooms/{roomId}/chatMessages')
    ->with('roomId', $roomId)
    ->toStream();

// Contains "GET https://stream.gitter.im/v1/rooms/.../chatMessages" url

$client->viaStream()->request($route)->subscribe(function($message) {
     var_dump($message);
    // Subscribe on every message in target room (Realtime subscribtion)
});

$client->connect();
```

Available route methods:

- `Route::get(string $route)` - GET http method
- `Route::post(string $route)` - POST http method
- `Route::put(string $route)` - PUT http method
- `Route::patch(string $route)` - PATCH http method
- `Route::delete(string $route)` - DELETE http method
- `Route::options(string $route)` - OPTIONS http method
- `Route::head(string $route)` - HEAD http method
- `Route::connect(string $route)` - CONNECT http method
- `Route::trace(string $route)` - TRACE http method

Route arguments:

- `$route->with(string $key, string $value)` - Add route or GET query parameter
- `$route->withMany(array $parameters)` - Add route or GET query parameters
- `$route->withBody(string $key, string $value)` - Add POST, PUT, DELETE, etc body parameter

See more info about API into [Documentation](https://developer.gitter.im/docs/welcome)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~27 days

Recently: every ~147 days

Total

36

Last Release

2812d ago

Major Versions

1.1.2 → 2.0.02016-03-23

2.1.1 → 3.0.02016-10-23

3.0.3 → 4.0.02016-12-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/150420?v=4)[Ruslan Sharipov](/maintainers/Serafim)[@serafim](https://github.com/serafim)

---

Top Contributors

[![SerafimArts](https://avatars.githubusercontent.com/u/2461257?v=4)](https://github.com/SerafimArts "SerafimArts (100 commits)")

---

Tags

apiasyncclientgitterlibraryphp7streamingasyncapiclientreactgitter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/serafim-gitter-api/health.svg)

```
[![Health](https://phpackages.com/badges/serafim-gitter-api/health.svg)](https://phpackages.com/packages/serafim-gitter-api)
```

###  Alternatives

[react/datagram

Event-driven UDP datagram socket client and server for ReactPHP

99759.5k36](/packages/react-datagram)[recoil/recoil

Asynchronous coroutines for PHP 7.

78961.5k7](/packages/recoil-recoil)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.3k](/packages/toin0u-geotools)[recoil/react

Integrate Recoil with ReactPHP.

32274.4k12](/packages/recoil-react)[clue/socks

Async SOCKS proxy client and server (SOCKS4, SOCKS4a and SOCKS5)

611.0k](/packages/clue-socks)[clue/socket-react

Binding for raw sockets (ext-sockets) in reactphp

211.5k2](/packages/clue-socket-react)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
