Download the PHP package auto-swagger/php-swagger-generator without Composer
On this page you can find all versions of the php package auto-swagger/php-swagger-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download auto-swagger/php-swagger-generator
More information about auto-swagger/php-swagger-generator
Files in auto-swagger/php-swagger-generator
Package php-swagger-generator
Short Description Automatic Swagger/OpenAPI documentation generator using PHP attributes
License MIT
Informations about the package php-swagger-generator
Laravel Auto Swagger Documentation
Auto Swagger for Laravel is a package that helps you generate Swagger/OpenAPI 1.0 documentation quickly and easily for your Laravel applications.
Installation
-
Install the package via Composer:
- Publish the necessary files:
Generating Documentation
To generate the OpenAPI documentation, run:
Output Format Options
The generator supports both JSON and YAML formats:
-
Generate JSON (default):
- Generate YAML:
When using the default JSON format, the documentation will be accessible at: http://localhost:8000/api/documentation/json
1. All attributes must be written in controller
2. If you are using resource controller write apiResource instead resource
3. Remove unused and Deleted controller usings namespaces
Attributes
Route Documentation
To include a route in the API documentation, use the ApiSwagger
attribute:
Properties:
summary
: Description of the routetag
: Group identifier for related routes
Request Documentation
Document request parameters using ApiSwaggerRequest
:
On the controller method you need use Request class for validation, if you does not do this AutoSwager will not parse RequestBody
Query Parameters
Use ApiSwaggerQuery
to define filter parameters for your API endpoints:
if you need paste id Of model you need make isId parameter true
The format for each query parameter is:
'parameter_name' => 'type|required/optional|description'
Supported types:
- string
- integer
- boolean
- date
- array
- float
Example of a complete endpoint with query parameters:
Response Documentation
Document API responses using ApiSwaggerResponse
. You can specify the response structure in three ways:
-
Using an array:
-
Using an API Resource class:
- Using a Model class:
Resource class
Pagination Support
To implement pagination in your API documentation:
-
Create a paginated resource class that extends
PaginatedResource
: - Set
isPagination
to true in yourApiSwaggerResponse
attribute:
For each reload on api/documentation route regenerate docs set environment:
Support
For support, feedback, or questions, contact the maintainer at: [email protected]
All versions of php-swagger-generator with dependencies
nikic/php-parser Version ^5.3
php Version ^8.2
symfony/yaml Version ^7.1