poprigun-chat
poprigun-chat, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require poprigun/chat "*"
or add, (*4)
"poprigun/chat": "*"
to the require section of your composer.json
file., (*5)
Usage
Once the extension is installed, simply use it in your code by :, (*6)
php
, (*7)
= \poprigun\chat\widgets\StaticChat::widget([
'template' => 'path',
'node => true,
'options' => [
'dialogTime' => 0,
'messageTime' => 0,
'form' => '#poprigun-chat-send-form',
],
]);?>= \poprigun\chat\widgets\ChatButton::widget([
'options' => [
'receiver_id' => $user->id,
'text' => 'Message',
],
]
)?>
js
, (*8)
$(window).ready(function(){
poprigunChat.loadDialogs();
poprigunChat.listenServerDialog();
});, (*9)
Template
Templates build with Handlebars, (*10)
Migration
yii migrate --migrationPath=@vendor/poprigun/chat/migrations, (*11)
Main config
'modules' => [
'poprigun_chat' => [
'class' => \poprigun\chat\PChatModule::className(),
'params' => [
'pchat-settings' => [
'userModel' => \frontend\models\User::className(),
'userAvatarMethod' => [
'class' =>\frontend\models\User::className(),
'method' =>'avatar',
],
'userNameMethod' => [
'class' =>\frontend\models\Profile::className(),
'method' =>'fullName',
'relation' => 'profile',
],
],
],
],
],, (*12)