bestit / kitchensink-bundle
帮助您创建包含路由、模板和服务的kitchensink。
1.1.0
2020-02-26 14:39 UTC
Requires
- php: ^7.0
- symfony/config: ^3.1 || ^4.0 || ^5.0
- symfony/dependency-injection: ^3.1 || ^4.0 || ^5.0
- symfony/http-kernel: ^3.1 || ^4.0 || ^5.0
- symfony/yaml: ^3.1 || ^4.0 || ^5.0
- twig/twig: ^2.12 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.5
- squizlabs/php_codesniffer: ^2.7
This package is auto-updated.
Last update: 2024-09-09 20:40:15 UTC
README
帮助您创建包含路由、模板和服务的kitchensink。
使用方法
此包为您提供了一个简单的控制器(/kitchensink)和服务结构,用于加载配置中定义的模板,并通过实现此包的DataProviderInterface接口的数据提供者填充数据。
安装
步骤1:下载Bundle
打开命令行界面,进入您的项目目录,并执行以下命令以下载此包的最新稳定版本
$ composer require bestit/kitchensink-bundle
此命令需要您全局安装Composer,如Composer文档中的安装章节所述。
步骤2:启用Bundle
然后,通过将其添加到项目app/AppKernel.php
文件中注册的Bundle列表中来启用该Bundle。
<?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:配置Bundle
# 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"