定制 itk-dev/config-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itk-dev/config-bundle

Composer 安装命令:

composer require itk-dev/config-bundle

包简介

A Symfony bundle to handle app config

README 文档

README

Installation

composer require itk-dev/settings-bundle "^1.0"

Enable the bundle in app/AppKernel.php:

public function registerBundles() {
	$bundles = [
		// …
        // Start of required dependencies of ItkDevConfigBundle
        new Craue\ConfigBundle\CraueConfigBundle(),
        new EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle(),
        // End of required dependencies for ItkDevConfigBundle
        new ItkDev\ConfigBundle\ItkDevConfigBundle(),
	];
    // …
}

In app/config/config.yml:

craue_config:
    entity_name: ItkDev\ConfigBundle\Entity\Setting

# Optionally, enable caching for craue/config-bundle (cf. https://github.com/craue/CraueConfigBundle/#enable-caching-optional)
services:
  craue_config_cache_provider:
    class: Symfony\Component\Cache\Adapter\FilesystemAdapter
    public: false
    arguments:
      - 'craue_config'
      - 0
      - '%kernel.cache_dir%'

Depending on your doctrine setup, you may have to add ItkDevConfigBundle to your doctrine mappings, e.g.:

doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    
                    ItkDevConfigBundle: ~

If using Doctrine migrations, you should filter out the craue_config_setting table from migrations:

doctrine:
    dbal:
        [...]
        schema_filter: ~^(?!craue_config_setting)~

Usage

Create settings in the database (preferably using a migration):

insert into
    itkdev_setting(section, name, type, form_type, value_string)
values
    ('cms', 'about_header', 'string', 'text', 'About this application');

insert into
    itkdev_setting(section, name, type, form_type, value_text)
values
    ('cms', 'about, 'text', 'text', 'This application handles configuration on the database.);

Easy admin:

See Resources/config/easy_admin.yml for an example Easy Admin configuration for Settings.

Twig:

See https://github.com/craue/CraueConfigBundle/#usage-in-twig-templates

Rich text

To use the form type ckeditor, you have to enable IvoryCKEditorBundle (which is already installed).

Follow steps 2–4 on https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/ivoryckeditorbundle.html#installing-the-rich-text-editor to enable the bundle.

统计信息

  • 总下载量: 552
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固