opencaching/kitchensink-bundle

帮助您创建包含路线、模板和服务的厨房用具。

1.0.7 2017-11-12 15:43 UTC

This package is auto-updated.

Last update: 2024-09-07 00:12:20 UTC


README

来自 https://github.com/bestit/symfony-kitchensink-bundle 的 php5.6 分支

bestit/kitchensink-bundle

帮助您创建包含路线、模板和服务的厨房用具。

Build Status Scrutinizer Code Quality Code Coverage

用法

此包为您提供一个简单的控制器(/kitchensink)和服务结构,用于加载配置中定义的模板,并通过实现此包的 DataProviderInterface 的数据提供者填充数据。

安装

步骤 1:下载包

打开命令行,进入您的项目目录,并执行以下命令以下载此包的最新稳定版本

$ composer require bestit/kitchensink-bundle

此命令要求您全局安装了 Composer,如 Composer 文档中的安装章节中所述。

步骤 2:启用包

然后,通过将其添加到项目 app/AppKernel.php 文件中注册的包列表中来启用该包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        // ...
        
        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
            $bundles[] = new BestIt\KitchensinkBundle\BestItKitchensinkBundle();
        }        

        // ...
    }

    // ...
}

步骤 3:配置包

# Default configuration for "BestItKitchensinkBundle"
best_it_kitchensink:

    # Which template should be used the render the kitchensink?
    template:             kitchensink/index.html.twig

    # The data provider service implementing the matching interface.
    data_provider:        ~ # Required

步骤 4:导入路由文件

# routing_dev.yml
best_it_kitchensink:
    resource: "@BestItKitchensinkBundle/resources/config/routing.yml"