Download the PHP package hyperf-plus/swagger without Composer

On this page you can find all versions of the php package hyperf-plus/swagger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swagger

HPlus Swagger 4.0

PHP Version Hyperf Version OpenAPI

为 Hyperf 框架打造的智能 API 文档生成组件,支持 OpenAPI 3.1.1 规范,自动集成 Route 和 Validate 组件。

✨ 4.0 新特性

📦 安装

可选依赖

🚀 快速开始

1. 发布配置

2. 配置

编辑 config/autoload/swagger.php

3. 使用示例

4. 访问文档

启动服务后访问:http://localhost:9501/swagger

📋 注解说明

@ApiResponse

@ApiResponseExample

@RequestBody

🎯 验证规则转换

当安装了 hyperf-plus/validate 时,Swagger 会自动将验证规则转换为 OpenAPI 参数定义:

验证规则 JSON Schema
required required: true
string type: string
integer type: integer
numeric type: number
boolean type: boolean
array type: array
email format: email
url format: uri
date format: date
min:N minimum: N / minLength: N
max:N maximum: N / maxLength: N
between:M,N minimum: M, maximum: N
in:a,b,c enum: [a, b, c]

示例

生成的 Schema:

🔧 配置详解

🛠️ 命令行工具

⚡ 性能优化

懒加载 + 缓存机制

Swagger 文档不在启动时生成,而是在首次访问 /swagger/json 时才构建,并缓存结果:

手动刷新缓存

如果代码有更新,需要重新生成文档:

🤝 组件协作

🧪 测试覆盖

运行测试:

📊 与 3.x 版本对比

特性 3.x 4.0
OpenAPI 版本 3.0.x 3.1.1
validate 依赖 硬依赖 软依赖(可选)
dateType 参数 ❌ 改为 mode
规则转换 部分支持 完整支持

📝 最佳实践

  1. 文档质量

    • 为每个接口添加 summarydescription
    • 提供请求和响应示例
    • 使用有意义的标签分组
  2. 安全考虑

    • 生产环境关闭 auto_generate
    • 限制文档访问权限
    • 不暴露敏感信息
  3. 版本管理
    • 使用版本前缀区分 API 版本
    • 标记废弃的接口 deprecated: true

🔗 相关链接

📄 License

MIT


All versions of swagger with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
hyperf/framework Version ^3.1.0
hyperf/di Version ^3.1.0
hyperf/http-server Version ^3.1.0
hyperf-plus/route Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperf-plus/swagger contains the following files

Loading the files please wait ...