Zwei gebürstete Aluminium-Wahlscheiben nebeneinander auf einer Stahl-Montageplatte mit feinen Kalibrierungsmarken, weiches Tageslicht.
Extension · moselwal/typo3-config · MIT-Lizenz

typo3-config — configuration as a fluent API.

Fluent PHP API for environment-specific TYPO3 configuration. Context-based presets (Production, Development, CLI, Testing), cascading secret resolution, caching auto-configuration via keyvalue-store, and TLS/mTLS auto-discovery. No more copy-pasted AdditionalConfiguration boilerplate.

  • Composer package:composer require moselwal/typo3-config
  • TYPO3: v11–v14 · PHP: 8.2+ · MIT
Das Problem

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:

  1. File path from env variable (DB_PASSWORD_FILE)
  2. Default secret file (/run/secrets/db_password)
  3. Direct env variable (getenv('DB_PASSWORD'))
  4. 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

MethodDescription
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 versionStatus
v11Supported
v12Supported (pagesection cache auto-removed)
v13Supported (imagesizes cache auto-removed)
v14Supported

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

Packagist

composer require moselwal/typo3-config

Package on Packagist →
Packagist

GitHub

Source code, issues, and changelogs. MIT-licensed.

View on GitHub →
GitHub
Nächster Schritt

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.

Refactor besprechen

Oder direkt schreiben: kontakt@moselwal.de

Where we use this …

This package carries the configuration API in TYPO3 Kubernetes and is the bridge to mTLS, cert-manager and external secret stores, as also demanded by Open Source & Digital Sovereignty. Managed variant: AI-Ready CMS as a Service.