Skip to content

OpenApiOptions

The document-level knobs OpenApiGenerator can’t derive from code: info, servers, and which routes to describe at all.

Everything else in the emitted spec comes from the route table and the actions’ own validator declarations, so this stays deliberately small.

OpenApiOptions::fromConfig() reads the core.openapi.* settings, so an app declares its API metadata once in settings.* and both openapi:generate and any programmatic caller agree on it.

final readonly class OpenApiOptions

Since1.2.5
SourceOpenapi/OpenApiOptions.php
PropertyTypeDescription
$description?``stringreadonly.
$excludeRoutesarrayreadonly.
$modulesarrayreadonly.
$problemResponsesboolreadonly.
$serversarrayreadonly.
$titlestringreadonly.
$useActionDocblocksboolreadonly.
$versionstringreadonly.

public function __construct(string $title = 'API', string $version = '1.0.0', ?string $description = null, list<array{url: string, description?: string}> $servers = [], list<string> $excludeRoutes = [], list<string> $modules = [], bool $problemResponses = true, bool $useActionDocblocks = true): mixed

Use each action class’s docblock as its operation summary/description. Turn off for an app whose action docblocks are internal notes rather than API prose.

ParameterTypeDescription
$titlestring
$versionstring
$description?``string
$serverslist``<``array{url: string, description?: string}``>
$excludeRouteslist``<``string``>fnmatch() patterns matched against route names; a matching route is left out.
$moduleslist``<``string``>Only describe routes belonging to these modules (case-insensitive); empty means all.
$problemResponsesboolEmit the RFC 9457 error responses (400 for routes with validators, 500) Quiote’s pipeline actually returns.
$useActionDocblocksboolUse each action class’s docblock as its operation summary/description. Turn off for an app whose action docblocks are internal notes rather than API prose.

Returns mixed

MethodDescription
coversModule(string $module): boolWhether $module is in scope (always true when no module filter is set).
excludes(string $routeName): boolWhether $routeName is excluded by any of the configured fnmatch patterns.
fromConfig(): OpenApiOptionsReads the core.openapi.* settings into an options snapshot.
normalizeServers(array<mixed> $servers): list<array{url: string, description?: string}>Accepts the two shapes a settings file can plausibly use — a bare list of URLs, or a list of {url, description} maps — and normalizes both to the OpenAPI Server Object shape.

public function coversModule(string $module): bool

Whether $module is in scope (always true when no module filter is set).

ParameterTypeDescription
$modulestring

Returns bool

public function excludes(string $routeName): bool

Whether $routeName is excluded by any of the configured fnmatch patterns.

ParameterTypeDescription
$routeNamestring

Returns bool

public static function fromConfig(): OpenApiOptions

Reads the core.openapi.* settings into an options snapshot.

The title falls back to core.app_name and then to API; an empty description setting becomes null rather than an empty string. servers is normalized to the {url, description?} entries OpenAPI expects, and malformed entries are dropped there.

Returns OpenApiOptions

public static function normalizeServers(array<mixed> $servers): list<array{url: string, description?: string}>

Accepts the two shapes a settings file can plausibly use — a bare list of URLs, or a list of {url, description} maps — and normalizes both to the OpenAPI Server Object shape.

ParameterTypeDescription
$serversarray``<``mixed``>

Returns list``<``array{url: string, description?: string}``>