PHPackages                             get-stream/stream-chat - 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. [API Development](/categories/api)
4. /
5. get-stream/stream-chat

ActiveLibrary[API Development](/categories/api)

get-stream/stream-chat
======================

A PHP client for Stream Chat (https://getstream.io/chat/)

3.17.0(2mo ago)301.8M↓13.8%9[5 issues](https://github.com/GetStream/stream-chat-php/issues)[1 PRs](https://github.com/GetStream/stream-chat-php/pulls)2BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Jun 25Pushed 1mo ago28 watchersCompare

[ Source](https://github.com/GetStream/stream-chat-php)[ Packagist](https://packagist.org/packages/get-stream/stream-chat)[ Docs](https://getstream.io/chat/)[ RSS](/packages/get-stream-stream-chat/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (62)Used By (2)

> **Note:** [`getstream-php`](https://github.com/GetStream/getstream-php) is the new full-product PHP SDK for Stream, covering Chat, Video, Moderation, and Feeds with long-term support.
>
> **`stream-chat-php` is now in maintenance mode.** It will continue to receive critical fixes and requested features, so it is safe to keep using. However, we encourage existing users to migrate when convenient and strongly recommend that new projects start with `getstream-php`.
>
> Check out the [Migration Guide](https://github.com/GetStream/getstream-php/blob/39943f2219006418a41118f97b1d28f9233f72f3/docs/migration-from-stream-chat-php) for side-by-side examples covering common use cases.

Official PHP SDK for [Stream Chat](https://getstream.io/chat/)
==============================================================

[](#official-php-sdk-for-stream-chat)

[![build](https://github.com/GetStream/stream-chat-php/workflows/build/badge.svg)](https://github.com/GetStream/stream-chat-php/actions) [![Latest Stable Version](https://camo.githubusercontent.com/440dfb675fc0749c843af77bd086b489a52cd32a8c4df13fe36373d577538308/68747470733a2f2f706f7365722e707567782e6f72672f6765742d73747265616d2f73747265616d2d636861742f762f737461626c65)](https://packagist.org/packages/get-stream/stream-chat)

 [![](./assets/logo.svg)](./assets/logo.svg)

 Official PHP API client for Stream Chat, a service for building chat applications.
 [**Explore the docs »**](https://getstream.io/chat/docs/)

 [Report Bug](https://github.com/GetStream/stream-chat-php/issues) · [Request Feature](https://github.com/GetStream/stream-chat-php/issues)

📝 About Stream
--------------

[](#-about-stream)

You can sign up for a Stream account at our [Get Started](https://getstream.io/chat/get_started/) page.

You can use this library to access chat API endpoints server-side.

For the client-side integrations (web and mobile) have a look at the JavaScript, iOS and Android SDK libraries ([docs](https://getstream.io/chat/)).

⚙️ Installation
---------------

[](#️-installation)

```
$ composer require get-stream/stream-chat
```

✨ Getting started
-----------------

[](#-getting-started)

```
require_once "./vendor/autoload.php";
```

Instantiate a new client, find your API keys in the dashboard.

```
$client = new GetStream\StreamChat\Client("", "");
```

### Generate a token for client-side usage

[](#generate-a-token-for-client-side-usage)

```
$token = $client->createToken("bob-1");

// with an expiration time
$expiration = (new DateTime())->getTimestamp() + 3600;
$token = $client->createToken("bob-1", $expiration);
```

### Update / Create users

[](#update--create-users)

```
$bob = [
    'id' => 'bob-1',
    'role' => 'admin',
    'name' => 'Robert Tables',
];

$bob = $client->upsertUser($bob);

// Batch update is also supported
$jane = ['id' => 'jane', 'role' => 'admin'];
$june = ['id' => 'june', 'role' => 'user'];
$tom = ['id' => 'tom', 'role' => 'guest'];
$users = $client->upsertUsers([$jane, $june, $tom]);
```

### Channel types

[](#channel-types)

```
$channelConf = [
    'name' => 'livechat',
    'automod' => 'disabled',
    'commands' => ['ban'],
    'mutes' => true
];

$channelType = $client->createChannelType($channelConf);

$allChannelTypes =  $client->listChannelTypes();
```

### Channels and messages

[](#channels-and-messages)

```
$channel = $client->Channel("messaging", "bob-and-jane");
$state = $channel->create("bob-1", ['bob-1', 'jane']);
$channel->addMembers(['mike', 'joe']);
```

### Messaging

[](#messaging)

```
$msg_bob = $channel->sendMessage(["text" => "Hi June!"], 'bob-1');

// Reply to a message
$reply_bob = $channel->sendMessage(["text" => "Long time no see!"], 'bob-1', $msg_bob['message']['id']);
```

### Reactions

[](#reactions)

```
$channel->sendReaction($reply_bob['message']['id'], ['type' => 'like'], 'june');
```

### Moderation

[](#moderation)

```
$channel->addModerators(['june']);
$channel->demoteModerators(['june']);

$channel->banUser('june', ["reason" => "Being a big jerk", "timeout" => 5, "user_id" => 'bob-1']);
$channel->unbanUser('june', ["user_id" => 'bob-1']);
```

### Devices

[](#devices)

```
$device_id = "iOS_Device_Token_123";
$client->addDevice($device_id, "apn", "june");
$devices = $client->getDevices('june');

$client->deleteDevice($device_id, 'june');
```

🙋‍♀️ Frequently asked questions
-------------------------------

[](#‍️-frequently-asked-questions)

- **Q**: What date formats does the backend accept?
- **A**: We accept [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) format. So you either use raw strings as date or you implement a serializer for your DateTime object.

```
class MyDateTime extends \DateTime implements \JsonSerializable
{
    public function jsonSerialize()
    {
        // Note: this returns ISO8601
        // but it's compatible with 3339
       return $this->format("c");
    }
}

$createdAt = new MyDateTime();

$client->search(
	['type' => "messaging"],
	['created_at' => ['$lte' => $createdAt]],
	['limit' => 10]
);
```

✍️ Contributing
---------------

[](#️-contributing)

We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our [license file](./LICENSE) for more details.

Head over to [CONTRIBUTING.md](./CONTRIBUTING.md) for some development tips.

🧑‍💻 We are hiring!
------------------

[](#‍-we-are-hiring)

We've recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and we keep actively growing. Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

Check out our current openings and apply via [Stream's website](https://getstream.io/team/#jobs).

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity52

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~46 days

Recently: every ~26 days

Total

53

Last Release

81d ago

Major Versions

1.4.0 → 2.0.02021-03-24

2.11.1 → 3.0.02022-08-29

PHP version history (5 changes)1.0.0PHP &gt;=5.5

1.1.4PHP &gt;=5.7

2.0.0PHP &gt;=7.3

3.0.0PHP &gt;=7.4

3.4.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/88735?v=4)[Tommaso Barbugli](/maintainers/tbarbugli)[@tbarbugli](https://github.com/tbarbugli)

---

Top Contributors

[![pterk](https://avatars.githubusercontent.com/u/188764?v=4)](https://github.com/pterk "pterk (50 commits)")[![ferhatelmas](https://avatars.githubusercontent.com/u/648018?v=4)](https://github.com/ferhatelmas "ferhatelmas (37 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (26 commits)")[![peterdeme](https://avatars.githubusercontent.com/u/19969687?v=4)](https://github.com/peterdeme "peterdeme (24 commits)")[![tbarbugli](https://avatars.githubusercontent.com/u/88735?v=4)](https://github.com/tbarbugli "tbarbugli (16 commits)")[![totalimmersion](https://avatars.githubusercontent.com/u/1247198?v=4)](https://github.com/totalimmersion "totalimmersion (6 commits)")[![gumuz](https://avatars.githubusercontent.com/u/40196?v=4)](https://github.com/gumuz "gumuz (4 commits)")[![javierdfm](https://avatars.githubusercontent.com/u/1611133?v=4)](https://github.com/javierdfm "javierdfm (3 commits)")[![JimmyPettersson85](https://avatars.githubusercontent.com/u/953852?v=4)](https://github.com/JimmyPettersson85 "JimmyPettersson85 (3 commits)")[![Acconut](https://avatars.githubusercontent.com/u/1375043?v=4)](https://github.com/Acconut "Acconut (2 commits)")[![daksh-r](https://avatars.githubusercontent.com/u/192087097?v=4)](https://github.com/daksh-r "daksh-r (2 commits)")[![nijeesh-stream](https://avatars.githubusercontent.com/u/195436394?v=4)](https://github.com/nijeesh-stream "nijeesh-stream (2 commits)")[![rafaelmf3](https://avatars.githubusercontent.com/u/5933178?v=4)](https://github.com/rafaelmf3 "rafaelmf3 (2 commits)")[![thesyncim](https://avatars.githubusercontent.com/u/916501?v=4)](https://github.com/thesyncim "thesyncim (2 commits)")[![vishalnarkhede](https://avatars.githubusercontent.com/u/11586388?v=4)](https://github.com/vishalnarkhede "vishalnarkhede (2 commits)")[![yaziine](https://avatars.githubusercontent.com/u/4570448?v=4)](https://github.com/yaziine "yaziine (2 commits)")[![bdandy](https://avatars.githubusercontent.com/u/7849405?v=4)](https://github.com/bdandy "bdandy (1 commits)")[![nikola-jovanovic-php](https://avatars.githubusercontent.com/u/62754661?v=4)](https://github.com/nikola-jovanovic-php "nikola-jovanovic-php (1 commits)")[![carldemic](https://avatars.githubusercontent.com/u/16418271?v=4)](https://github.com/carldemic "carldemic (1 commits)")[![prondubuisi](https://avatars.githubusercontent.com/u/22311928?v=4)](https://github.com/prondubuisi "prondubuisi (1 commits)")

---

Tags

chatchat-apiphpreststreamapichatchat-sdk

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/get-stream-stream-chat/health.svg)

```
[![Health](https://phpackages.com/badges/get-stream-stream-chat/health.svg)](https://phpackages.com/packages/get-stream-stream-chat)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)

PHPackages © 2026

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