typo3-config — configuration as a fluent API.
Goodbye copy-pasted LocalConfiguration. typo3-config provides a fluent, chainable API for TYPO3 configuration with context-based presets (Production, Development, CLI, Testing) and cascading secret resolution. MIT licence, runs from TYPO3 11 to 14.
Configuration code that migrates from project to project.
With typo3-config
- Fluent, chainable API:
$config->forContext('Production')->withCache(...) - Context-based presets: Production, Development, CLI, Testing
- Cascading secret resolution via secret-resolver
- Caching auto-configuration via keyvalue-store
- TLS/mTLS discovery automatic
- Mailer and logging helpers
Until now
- Copy-pasted AdditionalConfiguration with magic strings
- No separation between Production, Dev, and CLI setup
- Secrets as plain ENV lookups, no cascading
- Caching configuration as boilerplate
- TLS/mTLS discovery done by hand
Four building blocks
Mailer/logging helpers
Pre-built setups for Symfony Mailer (SMTP/Sendmail/Postmark), Monolog channels with context enrichment, rotating file handler.
Secret cascading
Integration with secret-resolver — secrets from file, ENV, or default fallback, cleanly prioritised.
Context presets
Production, Development, CLI, Testing — each with sensible defaults that can be overridden per method.
Fluent API
Chainable configuration methods instead of array manipulation — IDE autocomplete, static analysis, tests all available.
Quick start
In your config/config.php:
<?php
use Moselwal\Config;
Config::initialize()
->loadCoreSecrets()
->loadMailSecrets()
->autoconfigureCaching();
Extended usage
Config::get()
->useGraphicsMagick()
->useMailpit()
->autoconfigureCaching()
->setPhpSettings([
'memory_limit' => '512M',
'max_execution_time' => 120,
])
->setConfigPathValues('SYS', [
'defaultScheme' => 'https',
]);Secret management
Secrets are resolved through a cascading lookup:
- File path from env variable (
DB_PASSWORD_FILE) - Default secret file (
/run/secrets/db_password) - Direct env variable (
getenv('DB_PASSWORD')) - Fallback parameter (optional)
# Docker secrets or Kubernetes mounts
echo "supersecret" > /run/secrets/db_password
Config::get()->loadCoreSecrets();
No secrets need to be committed to Git or stored in .env files.
Presets and compatibility
Available presets
| Method | Description |
|---|---|
applyDefaults() | Auto-selects the preset based on the TYPO3 context |
useCliPreset() | Optimised for CLI calls with debug output |
useDevelopmentPreset() | Development environment settings |
useProductionPreset() | Production with APP_ROOT (container) |
useProductionPresetVHost() | Production with VHost-based setup |
TYPO3 version compatibility
| TYPO3 version | Status |
|---|---|
| v11 | Supported |
| v12 | Supported (pagesection cache auto-removed) |
| v13 | Supported (imagesizes cache auto-removed) |
| v14 | Supported |
Architecture
src/
├── Config.php # Main class (singleton, fluent API)
└── ConfigInterface.php # Public contract interface
tests/
├── ConfigTestCase.php # Base test class (singleton reset, $GLOBALS isolation)
├── TestableConfig.php # Test subclass for version injection
└── ... # 35+ tests with >120 assertions
Singleton pattern via Config::initialize() / Config::get(); namespace Moselwal\ → src/ (PSR-4); late static binding (new static()) for project-specific extensions.
Source code & docs
TYPO3 Extension Repository
Not in the official TER — install via Composer only.
Composer package
moselwal/typo3-config via the Moselwal Composer repo — MIT-licensed, freely usable.
GitLab (source of truth)
Primary repository including CI/CD and Composer package registry.
Standardise your TYPO3 setup?
typo3-config is open source and MIT-licensed. For refactoring legacy code, migrating away from sprawling AdditionalConfiguration files or standardising several TYPO3 installations, we are happy to help.
Oder direkt schreiben: kontakt@moselwal.de