Quick Example
The example below shows a fully annotated controller method using PHPDoc tags. The first line of the docblock becomes the operation summary, and any prose before the first tag becomes the long description.Supported Tags
Operation Metadata
Control how an operation appears in the generated spec using the tags below.- Summary & Description — The first line of the docblock is the operation summary. Any prose between the summary and the first tag becomes the long description.
@tags TagName, AnotherTag— Assigns the operation to one or more OpenAPI tags.@operationId customOperationId— Explicitly sets theoperationIdfor the operation.@deprecated— Marks the operation as deprecated in the OpenAPI output.@unauthenticated— Omits the security requirement for this specific endpoint, even when global authentication is configured.
Parameters
Document query parameters, path parameters, and request headers directly in the docblock.@queryParam name type Description— Documents a query parameter with an optional type and description.@pathParam name type Description— Documents a path parameter with an optional type and description.@headerParam name type Description— Documents a request header parameter.
Responses
Use@response to document the HTTP status codes and schemas your endpoint can return. Geni accepts resource class names, typed arrays, inline JSON literals, or plain text descriptions.
@response 200 ArticleResource— References an API resource class as the response schema.@response 200 ArticleResource[]— Documents a list response.@response 201 {"id": 1, "status": "created"}— Provides an inline JSON example.@response 204 No Content— Documents an empty response body.@throws ExceptionClass— Automatically infers the HTTP status code from the exception type (for example,ModelNotFoundExceptionmaps to 404).
Precedence Rules
When both inferred data and explicit annotations are present on the same endpoint, Geni resolves conflicts using the following priority order:You can mix PHP 8 attributes and PHPDoc annotations on the same endpoint. PHP 8 attributes always win when both define the same field — for example, a
#[Response] attribute takes precedence over a @response tag for the same status code.