MiddlewareConfigHandler
MiddlewareConfigHandler reads a middleware.{xml,php,yaml,yml} file — a flat list of <use> entries that register app/plugin middleware and/or override the placement or enabled state of any middleware (framework or app) known to #[Quiote\Middleware\Attribute\Middleware] scanning.
The compiled artifact returns the entry list; MiddlewareConfigHandler::apply() records it as a contribution on MiddlewareConfigRegistry, which MiddlewarePipeline::doBuild() merges with attribute-scanned definitions before ordering the pipeline. Fields left unset in an entry (represented as null in the canonical array) don’t override anything — they fall back to the class’s own #[Middleware] attribute, or framework defaults for a class with none.
Canonical schema: list<array{class: string, phase: ?string, priority: ?int, before: ?string, after: ?string, enabled: ?bool, override_framework: bool}>, in document order.
Synopsis
Section titled “Synopsis”class MiddlewareConfigHandler extends XmlConfigHandler implements IArrayConfigHandler, IDeclarationConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler
| Extends | XmlConfigHandler |
| Implements | IArrayConfigHandler, IDeclarationConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler |
| Since | 1.0.0 |
| Source | Config/MiddlewareConfigHandler.php |
Constants
Section titled “Constants”| Constant | Value | Description |
|---|---|---|
XML_NAMESPACE | 'http://quiote.dev/quiote/config/parts/middleware/1.1' |
Methods
Section titled “Methods”apply()
Section titled “apply()”public function apply(mixed $declaration, string $sourceRef): void
Record the declared entries as contributions on the registry the pipeline builder reads.
The normalized entry list MiddlewareConfigHandler::executeArray() compiles.
| Parameter | Type | Description |
|---|---|---|
$declaration | mixed | The normalized entry list MiddlewareConfigHandler::executeArray() compiles. |
$sourceRef | string |
execute()
Section titled “execute()”public function execute(XmlConfigDomDocument $document): mixed
Execute this configuration handler.
The document to parse.
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument | The document to parse. |
Returns mixed — The declaration to be cached.
| Throws | When |
|---|---|
ParseException | If a requested configuration file is improperly formatted. |
executeArray()
Section titled “executeArray()”public function executeArray(list<array{class: string, phase?: ?string, priority?: ?int, before?: ?string, after?: ?string, enabled?: ?bool, override_framework?: bool}> $config, ?string $sourceRef = null): mixed
Hand-authored PHP/YAML sources may omit any field but class;
omitted fields normalize to “don’t override” (null), matching
the XSD’s own optional attributes.
| Parameter | Type | Description |
|---|---|---|
$config | list``<``array{class: string, phase?: ?string, priority?: ?int, before?: ?string, after?: ?string, enabled?: ?bool, override_framework?: bool}``> | Hand-authored PHP/YAML sources may omit any field but class; omitted fields normalize to “don’t override” (null), matching the XSD’s own optional attributes. |
$sourceRef | ?``string |
Returns mixed
schema()
Section titled “schema()”public function schema(): Rule
“phase” values per middleware.xsd’s enum.
Only “class” is required — everything else means “don’t override” when omitted, matching the XSD’s own optional attributes.
Returns Rule
toCanonicalArray()
Section titled “toCanonicalArray()”public function toCanonicalArray(XmlConfigDomDocument $document): list<array{class: string, phase: ?string, priority: ?int, before: ?string, after: ?string, enabled: ?bool, override_framework: bool}>
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument |
Returns list``<``array{class: string, phase: ?string, priority: ?int, before: ?string, after: ?string, enabled: ?bool, override_framework: bool}``>
toCanonicalArrayWithPositions()
Section titled “toCanonicalArrayWithPositions()”public function toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: list<array{class: string, phase: ?string, priority: ?int, before: ?string, after: ?string, enabled: ?bool, override_framework: bool}>, positions: array<string, array{file: string, line: int}>}
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument | |
$positions | ElementPositionIndex |
Returns array{data: list<array{class: string, phase: ?string, priority: ?int, before: ?string, after: ?string, enabled: ?bool, override_framework: bool}>, positions: array<string, array{file: string, line: int}>}
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
appendParameter() | ParameterHolder | Append a parameter. |
appendParameterByRef() | ParameterHolder | Append a parameter by reference. |
clearParameters() | ParameterHolder | Clear all parameters associated with this request. |
getFlatParameterNames() | ParameterHolder | Retrieve an array of flattened parameter names. |
getParameter() | ParameterHolder | Retrieve a parameter. |
getParameterNames() | ParameterHolder | Retrieve an array of parameter names. |
getParameters() | ParameterHolder | Retrieve an array of parameters. |
hasParameter() | ParameterHolder | Indicates whether or not a parameter exists. |
initialize() | XmlConfigHandler | Initialize this ConfigHandler. |
literalize() | BaseConfigHandler | Literalize a string value. |
removeParameter() | ParameterHolder | Remove a parameter. |
replaceConstants() | BaseConfigHandler | Replace configuration directive identifiers in a string. |
replacePath() | BaseConfigHandler | Replace a relative filesystem path with an absolute one. |
reset() | ParameterHolder | Removes every parameter held, leaving the holder empty for reuse. |
setParameter() | ParameterHolder | Set a parameter. |
setParameterByRef() | ParameterHolder | Set a parameter by reference. |
setParameters() | ParameterHolder | Set an array of parameters. |
setParametersByRef() | ParameterHolder | Set an array of parameters by reference. |