Skip to main content

Overview

For developers who prefer docblocks over PHP 8 attributes, Geni reads the PHPDoc of each controller method. The first paragraph becomes the operation title and the rest its description:

Summary and Description

The free text of the docblock (everything before the tags) is split into two parts:
  • Summary: the first paragraph, with trailing periods removed. List published articles. becomes the operation summary List published articles.
  • Description: everything after the first blank line.

Precedence

When several sources define the title or description, Geni uses the first one it finds:
  1. #[Endpoint(title: ..., description: ...)]
  2. @summary tag (summary only) and @description tag (description only)
  3. The PHPDoc text (first paragraph and the rest)
  4. The route name (summary fallback, for example api.projects.index)

Markdown

Descriptions support a safe Markdown subset in the built-in blade portal: paragraphs, lists, headings, fenced code blocks, inline code, bold, italic and http(s) or relative links. Raw HTML is shown as text. Other renderers (Scalar, Stoplight Elements) render descriptions with their own Markdown support. See Documentation Renderers.

Supported Tags

Operation Metadata

  • @tags TagName, AnotherTag: Assigns the operation to OpenAPI tags.
  • @operationId customOperationId: Sets the operationId explicitly. Without it, Geni generates one; see Operation IDs.
  • @summary Text: Sets the operation summary, overriding the first docblock paragraph. A trailing period is removed.
  • @description Text: Sets the operation description, overriding the docblock paragraphs.
  • @deprecated [message]: Marks the operation as deprecated.
  • @unauthenticated: Omits security requirements for this specific endpoint.
  • @ignoreParam name: Leaves a parameter out of the documentation.
  • @requestMediaType type: Sets the request body media type.

Responses

  • @response [status] Type [description]: Documents the success response. The status defaults to 200.
    • @response ArticleResource
    • @response 201 ArticleResource Article created
    Naming a resource, model or Data class produces the same wrapped, fully inferred schema as returning it (for example {data: ArticleResource}).
  • @status 201 together with @body Type: An alternative way to declare the success status and type.
  • @throws ExceptionClass: Adds an error response inferred from the exception type (for example ValidationException maps to 422, AuthenticationException to 401, AuthorizationException to 403, ModelNotFoundException to 404). Map your own exceptions with withExceptionResponses().

Precedence Rules

When both inferred data and explicit annotations are present, Geni applies the following priority order:
  1. PHP 8 Attributes: Highest priority. Overrides all other sources.
  2. PHPDoc Annotations: Second priority. Overrides inferred data.
  3. Static Inference: Lowest priority. Used when no explicit annotations are provided.