Skip to content

Tag reference

@api

The @api tag marks an element as part of the stable, public API of its package. It tells both human readers and static analysis tools that the element is safe to depend on: unlike the rest of an internal or work-in-progress codebase, its signature is not expected to change between releases without a deprecation notice.

Grammar

"@api" [ <Description> ]
"@psalm-api" [ <Description> ]

Examples

A class marked as part of the public API.
/**
* @api
*/
final class Mailer {}
With a description explaining the guarantee.
/**
* @api Stable since 2.0; changes follow semantic versioning.
*/
public function send(Message $message): bool

Names by platform

psalm
@psalm-api
standard
@api

Parsing an @api tag produces an ApiTag instance. Being a pure marker, it adds nothing beyond the $name and optional $description every tag already carries.

final class ApiTag extends FlagTag {}

Defined by the PSR-19 draft PHPDoc Tags proposal and phpDocumentor’s tag reference.