cunningsoft / chat-bundle
Symfony2 的聊天组件
0.4
2014-08-18 20:22 UTC
Requires
- doctrine/orm: >=2.2.0
- knplabs/knp-time-bundle: 1.3
- symfony/symfony: ~2.3
This package is auto-updated.
Last update: 2024-09-12 09:01:17 UTC
README
安装
-
将以下内容添加到您的
composer.json
文件中// composer.json { // ... require: { // ... "cunningsoft/chat-bundle": "0.5.*" } }
-
运行
composer update cunningsoft/chat-bundle
安装新的依赖。 -
在您的
AppKernel.php
中注册新的包:(注意,您还需要在这里添加 KnpTimeBundle)<?php // in AppKernel::registerBundles() $bundles = array( // ... new Cunningsoft\ChatBundle\CunningsoftChatBundle(), new Knp\Bundle\TimeBundle\KnpTimeBundle(), // ... );
-
让您的用户实体实现
Cunningsoft\ChatBundle\Entity\AuthorInterface
// Acme\ProjectBundle\Entity\User.php <?php namespace Acme\ProjectBundle\Entity; use Cunningsoft\ChatBundle\Entity\AuthorInterface; class User implements AuthorInterface { // ...
-
在您的
config.yml
中将接口映射到用户实体// app/config/config.yml // ... doctrine: orm: resolve_target_entities: Cunningsoft\ChatBundle\Entity\AuthorInterface: Acme\ProjectBundle\Entity\User
-
更新您的数据库模式
$ app/console doctrine:schema:update
-
配置聊天组件
// app/config/config.yml // ... cunningsoft_chat: # refresh interval in milliseconds update_interval: 5000 # messages to be shown in chat number_of_messages: 10
-
导入路由
// app/config/routing.yml // ... cunningsoft_chat_bundle: resource: "@CunningsoftChatBundle/Controller" type: annotation
-
在模板中渲染聊天
// src/Acme/ProjectBundle/Resources/views/Default/index.html.twig // ... {% render(controller('CunningsoftChatBundle:Chat:show')) %} // ...
变更日志
-
0.5 (master) 支持 newer Symfony 版本
-
0.4 升级到 Symfony 2.3.* - 放弃对 Symfony 2.2.* 的支持
-
0.3 将 "Cunningsoft" 包含到命名空间中,以避免冲突
-
0.2 升级到 Symfony 2.2.* - 放弃对 Symfony 2.1.* 的支持
-
0.1 第一个工作版本。支持 Symfony 2.1.*
备注
请也访问我的开源浏览器游戏项目 Open Soccer Star.