Download the PHP package rafoabbas/api-docs without Composer
On this page you can find all versions of the php package rafoabbas/api-docs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rafoabbas/api-docs
More information about rafoabbas/api-docs
Files in rafoabbas/api-docs
Package api-docs
Short Description Generate API documentation (Postman collections & OpenAPI specs) from PHP attributes and YAML files
License MIT
Homepage https://github.com/rafoabbas/api-docs
Informations about the package api-docs
API Docs
Generate API documentation (Postman collections & OpenAPI specs) from PHP 8 attributes and YAML files.
Requirements
- PHP 8.2+
- Laravel 11+
Installation
Quick Start
Option 1: YAML Definitions (Recommended)
Define API endpoints in YAML files under resources/api-docs/:
Option 2: PHP Attributes
Add attributes to your controller:
Generate Documentation
Output (when variable_scope is collection):
Output (when variable_scope is environment):
Command Options
Attributes
| Attribute | Description |
|---|---|
ApiRequest |
Request name, description, order |
ApiFolder |
Group requests into folders |
ApiBody |
Request body (supports FormRequest merge) |
ApiResource |
Response Resource class |
ApiVariable |
Extract response values to variables |
ApiHeader |
Custom headers |
ApiQueryParam |
Query parameters |
ApiAuth |
Authentication config |
ApiResponse |
Example responses |
ApiTest |
Postman test scripts |
ApiPreRequest |
Pre-request scripts |
ApiHidden |
Exclude from docs |
ApiDeprecated |
Mark endpoints as deprecated |
Auto-Resolve Features
- Request body from FormRequest
rules() - Query parameters from FormRequest
rules()(for GET/DELETE requests) - Response structure from Resource
toArray() - Authentication from middleware (
auth:sanctum,auth) - Route parameters from URI (
{id}→:id) - OpenAPI schema from validation rules (
required|email→type: string, format: email) - PHP Enum to OpenAPI enum conversion (via
Rule::in()orEnumrule) - File upload auto-detection (
file,image,mimes:→multipart/form-data) - Pagination auto-detection (
paginate()→ paginated response schema)
Merging Strategy
YAML and PHP attributes can be used together. When both define the same endpoint (matched by method + uri):
- YAML definitions take priority over PHP attributes
- Merge is done field-by-field (non-null YAML fields override attribute fields)
- Unmatched requests from both sources are included
- YAML
body_mergeandbody_exceptallow merging YAML body with auto-resolved FormRequest body
This allows a YAML-first workflow where controllers stay clean and all API documentation lives in YAML files.
Swagger UI
Interactive API documentation is available at /api/docs by default.
Endpoints:
/api/docs- Swagger UI interface/api/docs/openapi.json- OpenAPI specification
Protect with token:
Access: /api/docs?token=your-secret-token
Disable in production:
Documentation
Full documentation is available on the Wiki:
Roadmap
Completed
- [x] Swagger UI integration - Interactive docs at
/api/docs - [x] Query parameter auto-resolve from FormRequest for GET/DELETE requests
- [x] Class-level
ApiPreRequestsupport - [x] YAML-first workflow with priority merge
- [x] YAML
resourcesupport for auto-resolving response from Resource classes - [x] YAML
body_merge/body_exceptfor merging with FormRequest body - [x] YAML
hiddensupport to exclude requests from docs - [x] YAML file-level shared
auth,headers,pre_request_scripts - [x] Configurable
variable_scope(collectionorenvironment) - [x] Validation rules to OpenAPI schema (
required|email→type: string, format: email) - [x] PHP Enum to OpenAPI enum conversion (via
Rule::in()orEnumvalidation rule) - [x]
#[ApiDeprecated]- Mark endpoints as deprecated (with reason and replacement) - [x] Pagination auto-detect (
paginate()→ paginated response schema with links/meta) - [x] File upload - Auto multipart/form-data support (
file,image,mimes:rules)
Export Formats
- [ ] Markdown export
- [ ] Insomnia export format
- [ ] Bruno export format
- [ ] Postman Cloud sync
Schema & Validation
- [ ] JSON:API specification support
Attributes
- [ ]
#[ApiRateLimit]- Document rate limits - [ ]
#[ApiWebhook]- Webhook documentation
Auto-Detection
- [ ] Factory examples - Generate example data from Laravel factories
Authentication
- [ ] OAuth2 flows documentation
- [ ] Multiple auth schemes per endpoint
UI & Visualization
- [ ] ReDoc UI - Alternative documentation UI
- [ ] Scalar UI - Modern API documentation (scalar.com)
- [ ] Code snippets - curl, JavaScript, Python, PHP examples
- [ ] API changelog - Version diff documentation
Versioning
- [ ] API versioning - Separate specs for v1, v2, etc.
License
MIT
All versions of api-docs with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.0
symfony/yaml Version ^6.0|^7.0