oooiik/laravel-export-postman
最新稳定版本:0.1.9
Composer 安装命令:
composer require oooiik/laravel-export-postman
包简介
Automatically generate a Postman collection based on your API routes.
README 文档
README
Package allows you to automatically generate a Postman collection based on your routes.
Installation
composer require oooiik/laravel-export-postman
Configuration
You can modify any of the export-postman.php config values to suit your export requirements.
Php Comments Documentation for API Annotations
Authentication
@AuthNo
No authentication is required for the annotated API endpoint.
@AuthParent
Inherits the authentication settings from the parent endpoint.
@AuthBearer [token]
Requires Bearer token authentication. Replace [token] with the actual token. Example:
@AuthBearer abc123
Headers
@Header [key] => [value]
Specifies a custom header for the API request.
Replace [key] with the header name and [value] with the header value.
@Header Accept => application/json
@Header Content-Type => application/json
Descriptions
@DescriptionContext [context]
Provides a brief description or context for the API request. Replace [context] with the description.
@DescriptionBasePath [path]
Specifies the base path description for the API endpoint. Replace [path] with the base path. Example:
@DescriptionBasePath /dir/file
@DescriptionResourcePath [path]
Specifies the resource path description for the API endpoint. Replace [path] with the resource path.
Pre-Request Scripts
@PreRequestScriptContext [path]
Defines a pre-request script to be executed before the API request. Replace [path] with the context or location of the script.
@PreRequestScriptFileBasePath [path]
Specifies the base path to the file containing the pre-request script. Replace [path] with the file location relative to the base directory.
@PreRequestScriptFileResourcePath [path]
Specifies the resource path to the file containing the pre-request script. Replace [path] with the specific file location.
Test Scripts
@TestScriptContext [context]
Defines a test script to be executed after the API request. Replace [context] with the context or description of the test script.
@TestScriptFileBasePath [path]
Specifies the base path to the file containing the test script. Replace [path] with the file location relative to the base directory.
@TestScriptFileResourcePath [path]
Specifies the resource path to the file containing the test script. Replace [path] with the specific file location.
Example:
class Container ... { /** * @AuthNo * @Header Accept => application/json * @DescriptionContext description for postman * @PreRequestScriptContext console.log('pre-request index method') * @TestScriptContext console.log('test index method') */ public function index(...) {...} /** * @AuthBearer {{TOKEN}} * @PreRequestScriptFileBasePath ./dir/filename * @TestScriptFileResourcePath ./dir/filename */ public function Show(...) {...} }
Usage
php artisan export:postman
统计信息
- 总下载量: 635
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-12