PHPackages                             denisbespyatov/directchat - 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. denisbespyatov/directchat

ActiveYii2-extension[Queues &amp; Workers](/categories/queues)

denisbespyatov/directchat
=========================

Yii2 direct chat

v1.0.0.1(2y ago)07MITPHP

Since Oct 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/denisbespyatov/directchat)[ Packagist](https://packagist.org/packages/denisbespyatov/directchat)[ RSS](/packages/denisbespyatov-directchat/feed)WikiDiscussions main Synced 1mo ago

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

\#Yii2 Direct chat A simple chat for your yii2 application

\##Installation

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist denisbespyatov/directchat

```

or add

```
"denisbespyatov/directchat": "*"

```

to the require section of your `composer.json` file.

\##Demo

Once the extension is installed, simply modify your application configuration as follows:

```
return [
    'bootstrap' => ['directchat'],
    'modules' => [
        'directchat' => [
            'class' => 'denisbespyatov\directchat\Module',
        ],
        // ...
    ],
    // ...
];
```

\##Usage

Extend the main `conversation` class like follow:

```
namespace common\models;

use common\models\User;
//...

class Conversation extends \denisbespyatov\directchat\db\Conversation
{
    public function getContact()
    {
        return $this->hasOne(User::className(), ['id' => 'contact_id']);
    }

    /**
     * @inheritDoc
     */
    protected static function baseQuery($userId)
    {
        return parent::baseQuery($userId) ->with(['contact.profile']);
    }

    /**
     * @inheritDoc
     */
    public function fields()
    {
        return [
            //...
            'contact' => function ($model) {
                return $model['contact'];
            },
            'deleteUrl',
            'readUrl',
            'unreadUrl',
            //...
        ];
    }
}
```

Extend the main `message` class like follow:

```
namespace common\models;

//...

class Message extends \denisbespyatov\directchat\db\Message
{
    /**
     * @inheritDoc
     */
    public function fields()
    {
        return [
            //...
            'text',
            'date' => 'created_at',
            //...
        ];
    }
}
```

Create a controller like follow:

```
namespace frontend\controllers;

//...
use yii\web\Controller;
use common\models\Conversation;
use common\models\Message;
use denisbespyatov\directchat\controllers\ControllerTrait;
//...

class MessageController extends Controller
{
    use ControllerTrait;

    /**
     * @return string
     */
    public function getMessageClass()
    {
        return Message::className();
    }

    /**
     * @return string
     */
    public function getConversationClass()
    {
        return Conversation::className();
    }
}
```

> Note: If you are using this extension in your frontend application, you can find the usage of widgets in `index.twig`.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

934d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4248476bf3b7b212047dc390c115d1d5c63a50ebd437d6ac0d323fe10babaa5e?d=identicon)[denisbespyatov](/maintainers/denisbespyatov)

---

Top Contributors

[![denisbespyatov](https://avatars.githubusercontent.com/u/60224716?v=4)](https://github.com/denisbespyatov "denisbespyatov (3 commits)")

---

Tags

messageyii2extensionchatconversation

### Embed Badge

![Health badge](/badges/denisbespyatov-directchat/health.svg)

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

###  Alternatives

[bubasuma/yii2-simplechat

A simple chat for your yii2 application

889.5k](/packages/bubasuma-yii2-simplechat)[trntv/yii2-command-bus

Yii2 Command Bus extension

57625.1k8](/packages/trntv-yii2-command-bus)[mikemadisonweb/yii2-rabbitmq

Wrapper based on php-amqplib to incorporate messaging in your Yii2 application via RabbitMQ. Inspired by RabbitMqBundle for Symfony 2, really awesome package.

74262.1k1](/packages/mikemadisonweb-yii2-rabbitmq)[arcanedev/laravel-messenger

Simple messaging system for Laravel

891.5k](/packages/arcanedev-laravel-messenger)[ignatenkovnikita/yii2-queuemanager

Yii2 Queue Manager

2061.8k2](/packages/ignatenkovnikita-yii2-queuemanager)

PHPackages © 2026

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