webcoast/typo3-context-config-loader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

webcoast/typo3-context-config-loader

Composer 安装命令:

composer require webcoast/typo3-context-config-loader

包简介

Easy to use configuration loader for loading context specific configuration

README 文档

README

A loader to make it easy to include context specific additional configuration files inside typo3conf/AdditionalConfiguration.php.

This loader can

  • load additional configuration from the current root and sub context
  • load local configuration files containing credentials
  • load a default configuration with non-standard settings (which would be removed from LocalConfiguration.php on each write)
  • read database credentials from a .my.cnf file.

Installation

Require via composer

composer req webcoast/typo3-config-loader

Usage

Put this inside your typo3conf/AdditionalConfiguration.php

(new \WEBcoast\Typo3ConfigLoader\Loader())->load();

This will automatically include configuration with standard settings (see below).

To adjust the behavior call the according setter function on the loader instance, e.g.

(new \WEBcoast\Typo3ConfigLoader\Loader())
    ->setIncludeDefaultConfiguration(true)
    ->setUseFolderPerContext(true)
    ->setIncludeMyCnf(true)
    ->setConfigFileSuffix('AdditionalConfiguration')
    ->load();

This loader does not parse different configuration formats like PHP, XML or YAML. It just requires the PHP files for the different context. The only file that is actually parsed is the .my.cnf file, if enabled. This gives you the freedom to do whatever you want inside those PHP files.

Order of inclusion

  1. Default.php (if enabled)
  2. .my.cnf (if enabled; parent context is applied first, if inheritance is enabled)
  3. Context specific PHP files (parent context is applied first, if inheritance is enabled)
  4. Local context specific PHP files (if enabled; parent context is applied first, if inheritance is enabled)

Settings

Setter method Type Default Description
setInheritFromParentContext boolean true If enabled the configuration for the root context (e.g. Production) would be included before the configuration from the current sub context (e.g. Production/Staging). If there is no sub context, the root context configuration will be always included.
setIncludeDefaultConfiguration boolean false If enabled the file {configRootPath}/Default.php will be included before any other configuration. This could be helpful to have non-standard settngs, which should be included in each context. Non-standard settings will be removed from LocalConfiguration.php, meaning they need to live either in your typo3conf/AdditionalConfiguration.php or on this Default configuration file.
setIncludeLocalConfigurationFiles boolean false If enabled files with a Local suffix will be included. The should be used to include files that only exist on the target server and are not part of your repository, because they contain credentials (database, SMTP, external API). This allows for versioned and unversioned setting for each context.
setIncludeMyCnf boolean false If enabled a .my.cnf style file (INI) is parsed to get the database credentials. Some sys-admins prefer those .my.cnf files to store the database credentials. They are also used, when accessing the database through the command line MySQL client.
setSubContextSeparator string: ., -, _ or empty . Adjust this to match your naming of your configuration files, e.g. Production/Staging would become Production.Staging.php or Production_Staging.php depending on this setting.
setConfigFileSuffix string empty If you want your configuration files look like ProductionConfig.php, set this to Config. This is required, when you use folders per context.
setUseFolderPerContext bool false Instead of putting all configuration files in the configuration root folder, folder are used for the different contexts, e.g. Production would be {configRoot}/Production and Production/Staging woudl be {configRoot}/Production/Staging. The config file suffix is used as the file name, e.g. Production/Staging/Config.php. If usage of local configuration files is enabled, they would look like Production/Staging/LocalConfig.php.

License

See the license file.

Contribution

Open an issue or fork and provide a pull request.

webcoast/typo3-context-config-loader 适用场景与选型建议

webcoast/typo3-context-config-loader 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.3k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 webcoast/typo3-context-config-loader 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webcoast/typo3-context-config-loader 我们能提供哪些服务?
定制开发 / 二次开发

基于 webcoast/typo3-context-config-loader 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2021-09-09