cunningsoft/chat-bundle

Symfony2 的聊天组件

安装次数: 8,086

依赖者: 2

建议者: 0

安全性: 0

星标: 15

关注者: 8

分支: 13

开放问题: 10

类型:symfony-bundle

0.4 2014-08-18 20:22 UTC

This package is auto-updated.

Last update: 2024-09-12 09:01:17 UTC


README

Build Status

安装

  1. 将以下内容添加到您的 composer.json 文件中

    // composer.json
    {
        // ...
        require: {
            // ...
            "cunningsoft/chat-bundle": "0.5.*"
        }
    }
  2. 运行 composer update cunningsoft/chat-bundle 安装新的依赖。

  3. 在您的 AppKernel.php 中注册新的包:(注意,您还需要在这里添加 KnpTimeBundle)

    <?php
    // in AppKernel::registerBundles()
    $bundles = array(
        // ...
        new Cunningsoft\ChatBundle\CunningsoftChatBundle(),
        new Knp\Bundle\TimeBundle\KnpTimeBundle(),
        // ...
    );
  4. 让您的用户实体实现 Cunningsoft\ChatBundle\Entity\AuthorInterface

    // Acme\ProjectBundle\Entity\User.php
    <?php
    
    namespace Acme\ProjectBundle\Entity;
    
    use Cunningsoft\ChatBundle\Entity\AuthorInterface;
    
    class User implements AuthorInterface
    {
        // ...
  5. 在您的 config.yml 中将接口映射到用户实体

    // app/config/config.yml
    // ...
    doctrine:
        orm:
            resolve_target_entities:
                Cunningsoft\ChatBundle\Entity\AuthorInterface: Acme\ProjectBundle\Entity\User
  6. 更新您的数据库模式

    $ app/console doctrine:schema:update
  7. 配置聊天组件

    // app/config/config.yml
    // ...
    cunningsoft_chat:
        # refresh interval in milliseconds
        update_interval: 5000
        # messages to be shown in chat
        number_of_messages: 10
  8. 导入路由

    // app/config/routing.yml
    // ...
    cunningsoft_chat_bundle:
        resource: "@CunningsoftChatBundle/Controller"
        type: annotation
  9. 在模板中渲染聊天

    // 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.