webcoast / typo3-context-config-loader
Easy to use configuration loader for loading context specific configuration
Installs: 1 847
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: ^8.1
- typo3/cms-core: ^12.4
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-11 13:06:49 UTC
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 require
s 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
Default.php
(if enabled).my.cnf
(if enabled; parent context is applied first, if inheritance is enabled)- Context specific PHP files (parent context is applied first, if inheritance is enabled)
- Local context specific PHP files (if enabled; parent context is applied first, if inheritance is enabled)
Settings
License
See the license file.
Contribution
Open an issue or fork and provide a pull request.