Extension · moselwal/typo3-config · MIT-Lizenz

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.

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.

Installation: composer require moselwal/typo3-config

TYPO3: 11 – 14.0 · PHP: 8.2+ · Licence: MIT · Required: composer/installers · Optional: moselwal/keyvalue-store

Add the Composer repository at gitlab.moselwal.io, then run composer require moselwal/typo3-config.

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

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.

Open the Composer repo

GitLab (source of truth)

Primary repository including CI/CD and Composer package registry.

gitlab.moselwal.io

GitHub

GitHub mirror (placeholder — verify before publish).

github.com/moselwal/typo3-config
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