Generate OpenAPI documentation for your RESTful API.

OpenAPI conformant

Generate OpenAPI documents in version 3.0 or 3.1.

Document your API inside PHP source code

Using swagger-php lets you write the API documentation inside the PHP source files which helps keeping the documentation up-to-date.

Annotation and Attribute support

Annotations can be either docblocks or PHP 8.1 attributes.

1. Install with composer:

> composer require zircote/swagger-php

2. Update your code

Add swagger-php annotations or attributes to your source code.

3. Generate OpenAPI documentation

> ./bin/openapi src -o openapi.yaml

4. Explore and interact with your API

Use an OpenAPI tool like Swagger UI to explore and interact with your API.