PHPackages                             gofmanaa/yii2-simplechat - 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. gofmanaa/yii2-simplechat

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

gofmanaa/yii2-simplechat
========================

A simple chat for your yii2 application

v2.0.1(10y ago)067BSD-3-ClausePHP

Since Dec 13Pushed 10y ago1 watchersCompare

[ Source](https://github.com/gofmanaa/yii2-simplechat)[ Packagist](https://packagist.org/packages/gofmanaa/yii2-simplechat)[ RSS](/packages/gofmanaa-yii2-simplechat/feed)WikiDiscussions master Synced 4w ago

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

\#Yii2 Simple 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 gofmanaa/yii2-simplechat

```

or add

```
   "gofmanaa/yii2-simplechat": "~2.0",

```

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

\##Demo only

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

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

Use the same configuration for your console application:

> Note: You need this configuration to access simple chat via command line. You can remove it in production mode.

You can access Simple Chat via command line as follows:

```
# change path to your application's base path
cd path/to/AppBasePath

# show available commands
php yii simplechat

# create test tables, generates and load fixtures
php yii simplechat/start

# unload fixtures
php yii simplechat/clean

# unload fixtures and load them again
php yii simplechat/reset

# unload fixtures and drop test tables
php yii simplechat/stop

```

You can specify different options of the `start` and `reset` command:

```
# You can specify how many fixtures per user and message you need by the --users and --messages options
php yii simplechat/start --users=50 --messages=10000
php yii simplechat/reset --users=20 --messages=5000

# You can specify in what language to generate fixtures by the --language option. Thanks to yii2-faker
php yii simplechat/start --language="ru_RU"
php yii simplechat/reset --language="fr_FR"

```

You can then access Simple Chat through the following URL:

```
http://localhost/path/to/index.php?r=messages/2

```

or if you have enabled pretty URLs, you may use the following URL:

```
http://localhost/path/to/index.php/messages/2

```

You should see the below:

[![yii simple chat demo page](https://camo.githubusercontent.com/aec522eea3e6dbc593610607af57bce6441978c2727e3dd066c0b688812d503c/687474703a2f2f692e696d6775722e636f6d2f31595a646a4e382e706e67 "yii simple chat demo page")](https://camo.githubusercontent.com/aec522eea3e6dbc593610607af57bce6441978c2727e3dd066c0b688812d503c/687474703a2f2f692e696d6775722e636f6d2f31595a646a4e382e706e67)

If not, please check if demo migration has been successfully applied against your database. You can check it by running the following command:

```
php yii simplechat/start

```

> Note: the command above is accessible only if you have configured your console application as it is recommended above.

\##Usage

Create an ActiveRecord like follow:

```
namespace common\models;

//...
use bubasuma\simplechat\db\Model;
use common\models\User;
use yii\db\ActiveQuery;
//...

class Message extends Model
{
    public function getContact()
    {
        return $this->hasOne(User::className(), ['id' => 'contact_id']);
    }

    /**
     * @inheritDoc
     */
    public static function conversations($userId)
    {
        return parent::conversations($userId)->with([
            //...
            'contact' => function ($contact) {
                /**@var $contact ActiveQuery * */
                $contact->with([
                    //...
                ])->select(['id', ]);
            },
            //...
        ]);
    }
}
```

Create a controller like follow:

```
namespace frontend\controllers;

//...
use yii\web\Controller;
use yii\helpers\StringHelper;
use common\models\Message;
use bubasuma\simplechat\controllers\ControllerTrait;
//...

class MessageController extends Controller
{
    use ControllerTrait;

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

    /**
     * @inheritDoc
     */
    public function formatMessage($model)
    {
        //...
        return $model;
    }

    /**
     * @inheritDoc
     */
    public function formatConversation($model)
    {
        //...
        $model['text'] = StringHelper::truncate($model['text'], 20);
        //...
        return $model;
    }
}
```

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

\##FAQ **Does this extension work with any template engines other than `twig`?**

Yes. Given that, the default render in `yii2` is `php`, you must indicate explicitly the extension part in view names.

**Can I use this extension in a RESTful APIs?**

Yes, You can.

**Can I use different template engines for rendering in server side and client side?**

Yes. But using the same template in both sides remains the best implementation.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

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

Total

5

Last Release

3683d ago

Major Versions

v1.0.0 → v2.0.0-alpha2016-01-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b84e6af576c112f5cfb1ef04877a9ae3a2a10a6ded9a42a9f6eca010200ef8d?d=identicon)[gofmanaa](/maintainers/gofmanaa)

---

Top Contributors

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

---

Tags

messageyii2extensionchatconversation

### Embed Badge

![Health badge](/badges/gofmanaa-yii2-simplechat/health.svg)

```
[![Health](https://phpackages.com/badges/gofmanaa-yii2-simplechat/health.svg)](https://phpackages.com/packages/gofmanaa-yii2-simplechat)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[bubasuma/yii2-simplechat

A simple chat for your yii2 application

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

Yii2 Command Bus extension

57660.0k8](/packages/trntv-yii2-command-bus)[arcanedev/laravel-messenger

Simple messaging system for Laravel

871.5k](/packages/arcanedev-laravel-messenger)

PHPackages © 2026

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