swagger-php

active
Tech Stack:
PHP OpenAPI Swagger

swagger-php is a PHP library that generates OpenAPI (Swagger) documentation from PHP annotations or attributes. It’s one of the most widely-used OpenAPI tools in the PHP ecosystem with over 5,000 GitHub stars.

Features

  • Annotation & Attribute Support — Use either PHP 8 attributes or doctrine annotations
  • OpenAPI 3.x Compatible — Full support for the OpenAPI 3.0 and 3.1 specifications
  • Framework Agnostic — Works with any PHP framework
  • Extensible — Custom processors for advanced use cases

Usage

#[OA\Info(title: "My API", version: "1.0")]
class OpenApi {}

#[OA\Get(path: "/users")]
#[OA\Response(response: 200, description: "List of users")]
public function getUsers() {}