c33s/construction-kit-bundle

此包已被废弃,不再维护。没有建议的替代包。

使用Symfony2将文件附加到任何(Propel)对象上

安装: 132

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

v0.3.2 2015-12-11 10:42 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:45:15 UTC


README

Build Status SensioLabsInsight codecov.io

这是为我准备的吗?

如果这些标准符合您的要求,请回答“是”

  • 开发/维护多个Symfony项目
  • 在大多数项目中使用相同(或相同子集)的包
  • 在大多数项目中使用相同(或相同子集)的资源
  • 厌倦了在每次项目中重复启用相同的包和添加相同的包配置
  • 需要保持项目部分同步/更新:在所有项目中提供新包或资源,而无需手动操作

这旨在加速您项目的快速开发以及长期维护可重用组件。

它做什么?

ConstructionKitBundle旨在通过提供所谓的构建块来简化项目依赖维护。

构建块是一个类,它提供以下信息:

  • 构建块所需的一个或多个Symfony包
  • 可选的YAML默认配置
  • 可选的(预填充)YAML配置文件,提供易于编辑的默认配置
  • 可选的资产(如js、css等),分为可用的assetic子集组
  • 可选的添加到parameters.yml和parameters.yml.dist的参数

构建块可以在识别后自动安装(可配置)。

Composer集成

由于ConstructionKit旨在减少手动操作,因此它允许在composer包中注册构建块。由composer发现的包将被自动发现,因此您只需做两件事

  • 添加composer依赖项并运行composer update
  • 运行app/console construction-kit:refresh来自动安装包、配置和资产

安装

construction-kit依赖于c33s/symfony-config-manipulator-bundle来拆分和管理配置文件。这将可能重构您在app/config/中的大部分配置结构。请前往c33s/symfony-config-manipulator-bundle了解更多信息,并在继续之前**务必提交您的配置**。

在您的composer.json文件中要求c33s/construction-kit-bundle

{
    "require": {
        "c33s/construction-kit-bundle": "@stable",
    }
}

或者,如果您正在使用'composer-yaml'

require:
    c33s/construction-kit-bundle:     '@stable'

app/AppKernel.php中注册所需的两个包

    // app/AppKernel.php

    public function registerBundles()
    {
        return array(
            // ... existing bundles
            new C33s\ConstructionKitBundle\C33sConstructionKitBundle(),
            new C33s\SymfonyConfigManipulatorBundle\C33sSymfonyConfigManipulatorBundle(),
        );
    }

用法

启用这两个包后,需要初始文件设置。只需运行以下命令:app/console construction-kit:refresh

您会看到类似以下的内容

    ######################################################
    #                                                    #
    # The symfony configuration has been changed.        #
    #                                                    #
    # Please re-run the construction-kit:refresh command #
    #                                                    #
    ######################################################

按照指示运行app/console construction-kit:refresh再次。然后检查文件app/config/config/c33s_construction_kit.map.yml,其中应包含以下配置

# This file is auto-updated each time construction-kit:refresh is called.
# This may happen automatically during various composer events (install, update)
#
# Follow these rules for your maximum building experience:
#
# [*] Only edit existing block classes in this file. If you need to add another custom building block class use the
#     composer extra 'c33s-building-blocks' or register your block as a tagged service (tag 'c33s_building_block').
#     Make sure your block implements C33s\ConstructionKitBundle\BuildingBlock\BuildingBlockInterface
#
# [*] You can enable or disable a full building block by simply setting the "enabled" flag to true or false, e.g.:
#     C33s\ConstructionKitBundle\BuildingBlock\ConstructionKitBuildingBlock:
#         enabled: true
#
#     If you enable a block for the first time, make sure the "force_init" flag is also set
#     C33s\ConstructionKitBundle\BuildingBlock\ConstructionKitBuildingBlock:
#         enabled: true
#         force_init: true
#
# [*] "use_config" and "use_assets" flags will only be used if block is enabled. They do not affect disabled blocks.
#
# [*] Asset lists will automatically be filled by all assets of asset-enabled blocks. To exclude specific assets, move them to their
#     respective "disabled" sections. You may also reorder assets - the order will be preserved.
#
# [*] Assets are made available through assetic using the @asset_group notation.
#
# [*] Custom YAML comments in this file will be lost!
#
c33s_construction_kit:
    mapping:
        building_blocks:
            C33s\ConstructionKitBundle\BuildingBlock\ConstructionKitBuildingBlock:
                enabled: true
                force_init: false
                use_config: true
                use_assets: true
            C33s\SymfonyConfigManipulatorBundle\BuildingBlock\ConfigManipulatorBuildingBlock:
                enabled: true
                force_init: false
                use_config: true
                use_assets: true
        assets: {  }

更多内容将陆续推出。