Documentation

WpConfigResolver
in package
implements ConfigResolverInterface

Read onlyYes
FinalYes

WordPress adapter for config resolution.

Resolution hierarchy: env var → wp_options → default. The key prefixes are configurable (defaults: MIDDAGLIB_ for env vars, middaglib_ for options) — a neutral marker meaning "came from this library, no product prefix was configured," carrying no brand of any consumer, including MIDDAG itself. A real product wires its own prefixes explicitly in its composition root (for example ACME_/acme_); every consumer plugin, MIDDAG's own products included, passes its own pair the same way. Env vars can be set via wp-config.php putenv(), a .env file (phpdotenv), Docker ENV, or server configuration (Apache/Nginx SetEnv).

Public surface: the consumer's composition root registers it for the framework ConfigResolverInterface, passing its own env/option prefixes.

Table of Contents

Interfaces

ConfigResolverInterface

Properties

$envPrefix  : string
$optionPrefix  : string

Methods

__construct()  : mixed
get()  : string
has()  : bool
resolve()  : string

Properties

Methods

__construct()

public __construct([string $envPrefix = 'MIDDAGLIB_' ][, string $optionPrefix = 'middaglib_' ]) : mixed
Parameters
$envPrefix : string = 'MIDDAGLIB_'
$optionPrefix : string = 'middaglib_'

get()

public get(string $key[, string|null $entitySlug = null ][, string $default = '' ]) : string
Parameters
$key : string
$entitySlug : string|null = null
$default : string = ''
Return values
string

has()

public has(string $key[, string|null $entitySlug = null ]) : bool
Parameters
$key : string
$entitySlug : string|null = null
Return values
bool

resolve()

private resolve(string $fullKey) : string
Parameters
$fullKey : string
Return values
string
On this page

Search results