yii2-chat Chat for registered users module for Yii 2.0 Framework advanced template

Chat for registered users module for Yii 2.0 Framework advanced template ¶

  1. Installation
  2. Usage
  3. Resources

The Yii2 extension module to chat for registered users using User model of advanced template.

Log visitor demo page

Log visitor

Installation ¶

The preferred way to install this extension is through composer.

Either run:

composer require slavkovrn/yii2-chat

or add

*"slavkovrn/yii2-chat": ""**

to the require section of your composer.json file.

Usage ¶

I.add link to ChatModule in your config

return [
    'modules' => [
        'chat' => [
            'class' => 'slavkovrn\chat\ChatModule',
            'numberLastMessages' => 30,
        ],
    ],
]; 

II. in your User model you should define two getters for name and link to icon of registered User

in my case that's

namespace app\models;
...
use app\models\Profile;
class User extends ActiveRecord implements IdentityInterface
{
    public function getChatname()
    {
        return Profile::find()->where(['id' => Yii::$app->user->id])->one()['name'];
    }
 
    public function getChaticon()
    {
        return Profile::find()->where(['id' => Yii::$app->user->id])->one()['photo'];
    }
    ...

and now you can chat with registered users via http://yoursite.com/chat url

Resources ¶

0 0
1 follower
0 downloads
Yii Version: 2.0
License: MIT
Category: User Interface
Created on: Aug 28, 2017
Last updated: 8 years ago

Related Extensions