registerProvider('bio.*', new BioConfigProvider()); * ``` * * ## Example Implementation * * ```php * class BioConfigProvider implements ConfigProvider * { * public function pattern(): string * { * return 'bio.*'; * } * * public function resolve( * string $keyCode, * ?object $workspace, * string|Channel|null $channel * ): mixed { * // Extract the specific key (e.g., "bio.theme" -> "theme") * $subKey = substr($keyCode, 4); * * return match ($subKey) { * 'theme' => $this->getTheme($workspace), * 'layout' => $this->getLayout($workspace), * default => null, * }; * } * } * ``` * * * @see ConfigResolver::registerProvider() */ interface ConfigProvider { /** * Get the key pattern this provider handles. * * Supports wildcards: * - `*` matches any characters * - `bio.*` matches "bio.theme", "bio.colors.primary", etc. * * @return string The key pattern (e.g., 'bio.*', 'theme.colors.*') */ public function pattern(): string; /** * Resolve a config value for the given key. * * Called when a key matches this provider's pattern. Return null if the * provider cannot supply a value for this specific key, allowing other * providers or the database to supply the value. * * @param string $keyCode The full config key being resolved * @param object|null $workspace Workspace model instance or null for system scope * @param string|Channel|null $channel Channel code or object * @return mixed The config value, or null if not provided */ public function resolve( string $keyCode, ?object $workspace, string|Channel|null $channel ): mixed; }