https://github.com/jdifool/tempest-openapi-tools
OpenAPI specification generator and interactive documentation UI for the Tempest framework.
https://github.com/jdifool/tempest-openapi-tools
openapi php scalar swagger-ui tempest
Last synced: 19 days ago
JSON representation
OpenAPI specification generator and interactive documentation UI for the Tempest framework.
- Host: GitHub
- URL: https://github.com/jdifool/tempest-openapi-tools
- Owner: jdifool
- Created: 2025-12-23T20:38:59.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-12-25T09:41:58.000Z (about 2 months ago)
- Last Synced: 2025-12-26T22:53:07.135Z (about 1 month ago)
- Topics: openapi, php, scalar, swagger-ui, tempest
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenAPI tools for Tempest PHP
OpenAPI specification generator and interactive documentation UI for the Tempest framework.
## Requirements
- PHP 8.4+
- Tempest framework v2.0
## Installation
```bash
composer require jdifool/tempest-openapi-tools
```
## Features
- Generate OpenAPI specification from PHP code annotations using [zircote/swagger-php](https://github.com/zircote/swagger-php)
- Serve OpenAPI spec dynamically via HTTP endpoint
- Interactive API documentation with Swagger UI or Scalar
## Usage
### Command Line
Generate an OpenAPI specification file:
```bash
./tempest openapi:generate
./tempest openapi:generate --path=src --output=public/openapi.json
```
### HTTP Endpoints
The package registers two routes (configurable):
| Route | Description |
|-------|-------------|
| `/documentation/openapi.json` | OpenAPI specification (JSON) |
| `/documentation/openapi` | Interactive API documentation UI |
## Configuration
Create `openapi.config.php` in your project:
```php
HTML;
}
}
```
## Custom Route Attributes
This package provides custom Tempest route attributes that read their paths from `OpenApiConfig`:
| Attribute | Description |
|-----------|-------------|
| `#[OpenApiSpecRoute]` | Route for OpenAPI JSON specification |
| `#[OpenApiUiRoute]` | Route for interactive documentation UI |
You can use these attributes in your own controllers if needed:
```php