theodo/quiz-bundle

一个简单的问答生成器包

安装: 10

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 3

开放问题: 0

类型:symfony-bundle

dev-master / 1.0.x-dev 2013-05-04 12:09 UTC

This package is not auto-updated.

Last update: 2024-09-24 05:35:59 UTC


README

This is TheodoQuizBundle. A simple bundle for managing quizes etc.

安装

此包目前通过composer不可用。为了将此包添加到您的symfony2项目中,请将以下仓库添加到您的 composer.json 文件中已有的仓库。

[...]
"repositories": [
    {...},
    {
        "type": "vcs",
        "url": "https://github.com/theodo/TheodoQuizBundle.git"
    }
],

然后,将包添加到应用程序所需的包中

"require": {
    ...,
    "theodo/quiz-bundle": "dev-master"
},

接下来,您只需要使用 composer.phar 更新您的项目

$ php composer.phar update theodo/quiz-bundle

在项目中启用该包

要启用包以工作,您需要在项目的 app/AppKernel.php 类中注册它,如下所示将其添加到已注册的包中

public function registerBundles()
{
    $bundles = array(
        // ...
        new Theodo\QuizBundle\TheodoQuizBundle(),
    );
}

最后但同样重要的是,路由激活:您需要加载包的路由配置以访问由包生成的网页。为此,编辑项目的 app/config/routing.yml 文件并在末尾添加以下行

theodo_quiz:
    resource: "@TheodoQuizBundle/Resources/config/routing/questions.xml"
    prefix: /

您可以将前缀更改为将页面移动到另一个前缀URL。

Twitter Bootstrap 依赖项

为了使Web界面尽可能舒适,包的模板系统需要Twitter Bootstrap的样式表。

如果您已经到达这里,这意味着Twitter Bootstrap文件已经包含在您的项目中(实际上是在包的 composer update 命令期间下载的)。您只需要将适当的文件复制到适当的位置。别担心,我们没有让您独自面对这项繁琐的任务。提供了一个脚本,该脚本需要在 composer installcomposer update 命令之后触发。只需将以下行添加到您的 composer.json 文件中

"scripts": {
    "post-install-cmd": [
        ...,
        "Theodo\\QuizBundle\\Composer\\ScriptHandler::symlinkTwitterBootstrapFiles"
    ],
    "post-update-cmd": [
        ...,
        "Theodo\\QuizBundle\\Composer\\ScriptHandler::symlinkTwitterBootstrapFiles"
    ]
},

要使 theodo/quiz-bundle 在项目中完全功能,您需要运行以下命令来复制所需的Twitter Bootstrap文件

$ php composer.phar install

享受吧!