Skip to content

feat(config): add modern PSR-4 config loaders#65

Merged
ralflang merged 1 commit intoFRAMEWORK_6_0from
feat/config-loaders-modern
Mar 14, 2026
Merged

feat(config): add modern PSR-4 config loaders#65
ralflang merged 1 commit intoFRAMEWORK_6_0from
feat/config-loaders-modern

Conversation

@ralflang
Copy link
Member

Summary

Add four specialized config loaders with immutable state objects for building modern APIs and frontends that don't require full legacy subsystem initialization.

Key Differences from Legacy

No globals: Return immutable state objects only - no $GLOBALS['conf'], $GLOBALS['backends'], etc.

Per-app isolation: Each app's config is separate and independently loaded, not stacked into one namespace like legacy Registry system.

Use Cases

  • Modern REST APIs (AdminApiController already uses ConfigLoader)
  • PSR-7/PSR-15 middleware that needs config without full Horde initialization
  • New frontends that load only what they need
  • CLI tools that need specific config without bootstrapping entire registry

Loaders Provided

  1. ConfigLoader: conf.php (deployment config)
  2. BackendConfigLoader: backends.php (driver configs with vendor defaults)
  3. PrefsConfigLoader: prefs.php (preference definitions with closures)
  4. RegistryConfigLoader: registry.php (global app registry with $this context)

Technical Features

  • 5-layer loading: vendor defaults → base → snippets → local → vhost
  • Vhost detection via Vhost object (no circular config dependencies)
  • All loaders registered in AppRouter DI container
  • Per-request caching
  • Layer introspection API for debugging

Tests

62 tests, 176 assertions, all passing.

Note

This is not for migrating legacy code - legacy Horde_Registry_Loadconfig continues working. This enables new code to load config without globals or legacy bootstrap overhead.

@ralflang ralflang closed this Mar 14, 2026
@ralflang ralflang reopened this Mar 14, 2026
Add four specialized config loaders with Vhost support:
- ConfigLoader: Application config (conf.php)
- BackendConfigLoader: Backend definitions (backends.php)
- PrefsConfigLoader: Preference definitions (prefs.php)
- RegistryConfigLoader: Global app registry (registry.php)

Each loader loads from 5 layers: vendor defaults, base config,
snippets, local overrides, and vhost overrides. All loaders
return immutable state objects and never populate globals.

Vhost detection externalized to Vhost object supporting auto-
detection from $_SERVER or explicit hostname. No circular
dependencies on config values.

style: php-cs-fixer
@ralflang ralflang force-pushed the feat/config-loaders-modern branch from eda38f0 to 9f1b763 Compare March 14, 2026 13:07
@ralflang ralflang merged commit 607076f into FRAMEWORK_6_0 Mar 14, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant