sourcebroker/configs
Composer 安装命令:
composer require sourcebroker/configs
包简介
Read configs based on TYPO3_CONTEXT settings.
README 文档
README
What does it do?
This extension include PHP files based on TYPO3_CONTEXT value. This allows you to make fine tuning of TYPO3 settings based on different context: instance, feature activation, system verbosity etc.
Installation
Install using composer:
composer require sourcebroker/configs
Add following code in
typo3conf/AdditionalConfiguration.php<?php defined('TYPO3') or die(); \SourceBroker\ConfigTypo3\Config::initialize() ->appendContextToSiteName() ->includeContextDependentConfigurationFiles();Create folder
contextin folderconfig.In folder
contextcreate folders that starts with 1_*, 2_*, 3_*, 4_*., example1_verbosity,2_mode,3_instanceInside those folders create php files with the names you will use in TYPO3_CONTEXT.
Example
- Copy example configs from
Resources/Private/Examples/Example1/contextto folderconfig/context - You can change the folder names
1_verbosity,2_mode,3_instanceto whatever you want but do not change thenumber_underscorepair. Numbers decide about what part of configs to read from the folders based on TYPO3_CONTEXT parts. Part after number and underscore play no role. - If TYPO3_CONTEXT will be set to
Development/Staging/Betathen fileDevelopment.phpwill be included from folder1_verbosity, fileStaging.phpwill be included from folder2_modeand fileBeta.phpwill be included from folder3_instance.
You can have as many folders with numbers as you like. You can also read more files from one folder when you separate string with comma.
For example you can set TYPO3_CONTEXT to Production//Live/Feature1,Feature2 then file Production.php will be included from folder
1_verbosity, file Live.php will be included from folder 3_mode and file Feature1.php, Feature2.php will be included
from folder 4_whatever.
If you install package helhum/dotenv-connector then you additionally have possibility to modify
$GLOBALS['TYPO3_CONF_VARS'] array by adding entries in .env file with following convention:
TYPO3__[first_level_array]__[second_level_array]__[third_level_array] = "value"
This allows you to provide database values per instance by putting following lines to .env files of each instance.
The .env file should be out of git.
Example:
TYPO3__DB__Connections__Default__dbname=".." TYPO3__DB__Connections__Default__host=".." TYPO3__DB__Connections__Default__port=".." TYPO3__DB__Connections__Default__user=".." TYPO3__DB__Connections__Default__password=".." TYPO3__GFX__processor_path=".." TYPO3__GFX__processor_path_lzw=".." TYPO3__GFX__processor_colorspace=".."
It is up to you to decide what values to put inside .env (which is out of git) and which
to config/context/3_instance/Live.php, config/context/3_instance/Beta.php etc which are inside git.
Lot of values stored in .env file means that it is harder to recreate the same TYPO3 state on local development system.
If those settings are in git then you can just switch TYPO3_CONTEXT from local TYPO3_CONTEXT=Development/Staging/Local
to beta TYPO3_CONTEXT=Production/Staging/Beta on local development system.
Database access data are good candidate to be put inside .env.
Uncache exceptions
You can use following code to disable uncaching on development for some cache configurations:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['configs']['caching']['cacheConfigurations']['my_cache']['uncache'] = false
Inspiration
- Extension https://github.com/b13/typo3-config
sourcebroker/configs 适用场景与选型建议
sourcebroker/configs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.1k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sourcebroker/configs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sourcebroker/configs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-01-19