venkatesanchinna / yii2-livechat
系统中的在线聊天
v1.0.6
2019-05-11 13:14 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-26 14:16:14 UTC
README
为 Yii 提供在线用户聊天功能
功能
- 与系统用户进行简单文本聊天
- 与 Yii2-livechat 集成 - 灵活的用户在线聊天模块
- 示例 URL: http://host/pathtoproject/backend/web/index.php?r=chat/livechat/view
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist venkatesanchinna/yii2-livechat "*"
或运行
composer require venkatesanchinna/yii2-livechat
或添加
"venkatesanchinna/yii2-livechat": "*"
到您的 composer.json
文件的 require 部分。
用法
-
让我们将模块配置添加到主配置文件中
'modules' => [ 'chat' => [ 'class' => 'venkatesanchinna\yii2livechat\Module' ] ]
然后,更新数据库架构
$ php yii migrate/up --migrationPath=@vendor/venkatesanchinna/yii2-livechat/migrations
好的。已经完成。现在可用的路由是
- /chat/livechat/view
-
注册聊天模块配置可用
use venkatesanchinna\yii2livechat\assets\LivechatAsset; LivechatAsset::register($this);
-
在您的网站上加载聊天视图
Add in view <div class="book_appointment ui-lc-viewers plus-minus"> <div class="book_head " style="bottom: 0px; opacity: 1; width: 322px;"> <span class="header_content book_app txtcap"></span> <span class=" fa fa-plus plus "></span> <div class="clear"></div> </div> <div class="book_form " > <div class="ui-container" style="bottom: -280px; opacity: 1;"></div> </div> </div>
-
调用聊天
$this->registerJs(' $().juichat({\'display_viewers\': true});');
-
演示用户
Username : user1 & user2 Password : user1 & user2
-
注意
+ This will work after login to the site so check the condition where loading the chat ui and script
许可证
MIT