diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..c12bcef75e8b29c35f51ecb3aa2653ffe80b62e0 --- /dev/null +++ b/README.en.md @@ -0,0 +1,40 @@ +# Swagger Annotation Library + +## Introduction +This is a PHP-based Swagger annotation library designed to define API documentation information via annotations within your project. It provides a set of attribute classes and processor interfaces to help developers quickly generate API documentation compliant with the OpenAPI specification. + +## Key Features +- Provides various annotations to define API operations, response formats, request parameters, etc. +- Supports automatic generation of JSON-formatted API response examples +- Offers a base processor interface for extending custom document processing logic + +## Core Components +- `ProcessorInterface` - Interface specification for document processors +- `AbstractProcessor` - Abstract base class for processors +- `ApiOperation` - Defines metadata for API operations +- `FormRequest` - Defines the structure of form request parameters +- `ResultResponse` and its subclasses - Define response formats for different scenarios +- `Property` - Defines data model properties + +## Usage Example +```php +// Use annotations in controller methods +#[ApiOperation('User Login')] +#[ReadResponse(User::class)] +public function login() +{ + // Your business logic +} +``` + +## Installation +Install via Composer: +```bash +composer require madong/swagger +``` + +## Contribution Guidelines +Contributions to code and documentation are welcome. Please fork the project, create a new branch for development, and submit a Pull Request. + +## License +MIT License - See the LICENSE file for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..875bf3122da57a81e7e85b0aa3d9f3fb26492a0a --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Swagger 注解库 + +## 简介 +这是一个基于 PHP 的 Swagger 注解库,用于在项目中通过注解方式定义 API 文档信息。它提供了一系列属性类和处理器接口,帮助开发者快速生成符合 OpenAPI 规范的接口文档。 + +## 主要功能 +- 提供多种注解属性用于定义 API 操作、响应格式、请求参数等 +- 支持自动生成 JSON 格式的 API 响应示例 +- 提供基础处理器接口用于扩展自定义文档处理逻辑 + +## 核心组件 +- `ProcessorInterface` - 文档处理器接口规范 +- `AbstractProcessor` - 抽象处理器基类 +- `ApiOperation` - 定义 API 操作元数据 +- `FormRequest` - 定义表单请求参数结构 +- `ResultResponse` 及其子类 - 定义不同场景的响应格式 +- `Property` - 定义数据模型属性 + +## 使用示例 +```php +// 在控制器方法中使用注解 +#[ApiOperation('用户登录')] +#[ReadResponse(User::class)] +public function login() +{ + // 你的业务逻辑 +} +``` + +## 安装 +通过 Composer 安装: +```bash +composer require madong/swagger +``` + +## 贡献指南 +欢迎贡献代码和改进文档。请先 fork 项目,创建新分支进行开发,最后提交 Pull Request。 + +## 许可证 +MIT License - 详见 LICENSE 文件 \ No newline at end of file