PHPackages                             carandclassic/talkjs - 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. carandclassic/talkjs

AbandonedArchivedLibrary[API Development](/categories/api)

carandclassic/talkjs
====================

PHP client for TalkJS API

v1.0.6(2y ago)454.9k↓37.5%5[2 issues](https://github.com/carandclassic/talkjs/issues)MITPHPPHP &gt;=7.4

Since Jul 8Pushed 2y agoCompare

[ Source](https://github.com/carandclassic/talkjs)[ Packagist](https://packagist.org/packages/carandclassic/talkjs)[ RSS](/packages/carandclassic-talkjs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (9)Used By (0)

TalkJS PHP SDK
==============

[](#talkjs-php-sdk)

[![Latest version](https://camo.githubusercontent.com/099621ce22f9bc2f16bf5c9473a3628dc6ce7f3728718436d4320afd09b453b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f436172416e64436c61737369632f74616c6b6a732e7376673f7374796c653d666c61742d737175617265)](https://github.com/CarAndClassic/talkjs/releases)[![Total downloads](https://camo.githubusercontent.com/0ad14f508578365fc2db43f39ca2b2ae3cd5474617c41a0cb894d0cbcc56cb35/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f436172416e64436c61737369632f74616c6b6a732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/CarAndClassic/talkjs)

Forked from [shapintv/talkjs](https://github.com/shapintv/talkjs).

For more information on parameters, custom data, and other things you can send with this API, please see the [TalkJS REST API documentation](https://talkjs.com/docs/Reference/REST_API/Getting_Started/Introduction.html).

The structure of this package is crafted around the TalkJS REST API structure, and as such all the following are treated as distinct APIs:

- Users
- Conversations
- Messages

Not implemented currently:

- Notifications
- Sending file Messages

Install
-------

[](#install)

Via Composer

```
$ composer require carandclassic/talkjs
```

Usage
-----

[](#usage)

This can be used as-is or with auto discovery in Laravel.

### Create a `TalkJSClient`

[](#create-a-talkjsclient)

```
use CarAndClassic\TalkJS\TalkJSClient;

$appId = 'my_app_id';
$secretKey = 'my_secret_key';
$talkJSClient = new TalkJSClient($appId, $secretKey);
```

### Laravel

[](#laravel)

Firstly, add `TALKJS_APP_ID` and `TALKJS_SECRET_KEY` to your env file. These are pulled in from the package's config automatically `talkjs.app_id` and `talkjs.secret_key` respectively.

If you'd like to change this, you can publish the application config and modify the `talkjs.php` config file in your application:

```
php artisan vendor:publish --provider=CarAndClassic\\TalkJS\\Providers\\TalkJSServiceProvider

```

Laravel's automatic service discovery will let you dependency inject `TalkJSClient` as per normal. Alternatively for one-off use you can also pass overriding `appId` and `secretKey` arguments using `app()->make()`:

```
$talkJSClient = app()->make(TalkJSClient::class, ['appId' => 'my_custom_app_id', 'secretKey' => 'my_custom_secret_key']);
```

### Input vs API data

[](#input-vs-api-data)

Below you'll see "input data" and "API data" referenced.

- Input data = data you sent via this package
- API data = data returned from the API

This is done because currently TalkJS returns empty 200 responses for successful resource update/creation, but it's still helpful to return what you've sent along.

### IDs

[](#ids)

TalkJS IDs for users and conversations are custom and managed by your application.

### Filtering

[](#filtering)

All endpoints that fetch multiple records (users, conversations, messages) have limit &amp; pagination options. API usage below will use a `$filters` variable where possible for demonstration, and it will look like this:

```
$filters = [
    'limit' => 50,
    'startingAfter' => 'latestMessageId'
];
```

### Creating a TalkJSClient

[](#creating-a-talkjsclient)

```
$appId = 'YOUR_APP_ID';
$secretKey = 'YOUR_SECRET_KEY';
$talkJSClient = new TalkJSClient($appId, $secretKey);
```

### Users

[](#users)

Please note TalkJS currently does not offer a user deletion API, and instead [recommend](https://talkjs.com/dashboard/tLjeWrEK/docs/Reference/REST_API/Users.html#page_Deleting-users) you use the update/edit endpoints to anonymise personally identifiable information.

- Creating or updating a user, returns `UserCreated` class with input data

```
$talkJSClient->users->createOrUpdate('my_custom_id', [
    "name" => "Alice",
    "email" => ["alice@example.com"],
    "welcomeMessage" => "Welcome!",
    "photoUrl" => "https =>//demo.talkjs.com/img/alice.jpg",
    "role" => "buyer",
    "phone" => ["+1123456789"],
    "custom" => [
        "foo" => "bar"
    ]
]);
```

- Retrieve a user, returns a `User` model class with API data

```
$talkJSClient->users->find('my_user_id');
```

- Get all users, returns an array of `User` model class with API data

```
$talkJSClient->users->find($filters);
```

- Get user's conversations, returns an array of `Conversation` model class with API data

```
$talkJSClient->users->getConversations('my_user_id');
```

### Conversations

[](#conversations)

- Create or update a conversation, returns a ConversationCreatedOrUpdated event class with input data

```
$talkJSClient->conversations->createOrUpdate('my_conversation_id', [
    'subject' => 'My new conversation',
    'participants' => ['my_user_id_1', 'my_user_id_2'],
    'welcomeMessages' => ['Welcome!'],
    'custom' => ['test' => 'test'],
    'photoUrl' => null
]);
```

- Retrive a conversation, returns a Conversation model class with API data

```
$talkJSClient->conversations->get('my_conversation_id');
```

- Find conversations, returns an array of `Conversation` model class with API data

```
$talkJSClient->conversations->find();
```

- Join a conversation, returns a `ConversationJoined` event class with input data

```
$talkJSClient->conversations->join('my_conversation_id', 'my_user_id');
```

- Leave a conversation, returns a `ConversationLeft` event class with input data

```
$talkJSClient->conversations->leave('my_conversation_id', 'my_user_id');
```

- Delete a conversation, returns a `ConversationLeft` event class with input data

```
$talkJSClient->conversations->delete('my_conversation_id');
```

- Update participation settings (notifications and read/write access)

```
$notify = true; // Boolean, default true
$access = 'ReadWrite'; // ReadWrite or Read, default ReadWrite
$talkJSClient->conversations->updateParticipation('my_conversation_id', 'my_user_id', $notify, $access);
```

### Messages

[](#messages)

For more information on custom data and filters, please refer to the TalkJS documentation linked above.

Please note:

- Sending file attachment is not yet implemented.
- Endpoints that return multiple messages will return them in descending order, i.e. latest first.

```
$custom = [
  'foo' => 'bar'
];
```

- Get messages in a conversation, returns an array of `Message` model class with API data

```
$talkJSClient->messages->get('my_conversation_id', $filters);
```

- Find specific message in a conversation

```
$talkJSClient->messages->find('my_conversation_id', 'message_id');
```

- Post a system message, returns a `MessageCreated` event class with input data and `type` of `SystemMessage`

```
$talkJSClient->messages->postSystemMessage('my_conversation_id', $text, $custom);
```

- Post a user message, returns a `MessageCreated` event class with input data and `type` of `UserMessage`

```
$talkJSClient->messages->postUserMessage('my_conversation_id', $username, $text, $custom);
```

- Edit a message, returns a `MessageEdited` event class with input data

```
$talkJSClient->messages->edit('my_conversation_id', 'message_id', $text, $custom);
```

- Delete a message, returns a `MessageDeleted` event class with no data

```
$talkJSClient->messages->delete('my_conversation_id', 'message_id');
```

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 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 ~170 days

Recently: every ~182 days

Total

7

Last Release

756d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/85986145?v=4)[Car &amp; Classic](/maintainers/CarAndClassic)[@carandclassic](https://github.com/carandclassic)

---

Top Contributors

[![wesleymartincc](https://avatars.githubusercontent.com/u/104444315?v=4)](https://github.com/wesleymartincc "wesleymartincc (10 commits)")[![BinaryKitten](https://avatars.githubusercontent.com/u/67553?v=4)](https://github.com/BinaryKitten "BinaryKitten (9 commits)")[![ashleyhindle](https://avatars.githubusercontent.com/u/454975?v=4)](https://github.com/ashleyhindle "ashleyhindle (1 commits)")[![nikspyratos](https://avatars.githubusercontent.com/u/17888779?v=4)](https://github.com/nikspyratos "nikspyratos (1 commits)")[![thomasowow](https://avatars.githubusercontent.com/u/45201651?v=4)](https://github.com/thomasowow "thomasowow (1 commits)")[![dannyyassine-ce](https://avatars.githubusercontent.com/u/91279213?v=4)](https://github.com/dannyyassine-ce "dannyyassine-ce (1 commits)")[![bram-pkg](https://avatars.githubusercontent.com/u/13304739?v=4)](https://github.com/bram-pkg "bram-pkg (1 commits)")

---

Tags

apichattalktalkjscarandclassic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carandclassic-talkjs/health.svg)

```
[![Health](https://phpackages.com/badges/carandclassic-talkjs/health.svg)](https://phpackages.com/packages/carandclassic-talkjs)
```

###  Alternatives

[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[get-stream/stream-chat

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

301.8M2](/packages/get-stream-stream-chat)[smnandre/pagespeed-api

PageSpeed Insight PHP Api Client 🚀 Analyse web pages for performances metrics, core web vitals...

1511.5k](/packages/smnandre-pagespeed-api)

PHPackages © 2026

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