Download the PHP package webman-tech/swagger without Composer

On this page you can find all versions of the php package webman-tech/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

webman-tech/swagger

本项目是从 webman-tech/components-monorepo 自动 split 出来的,请勿直接修改

简介

Swagger OpenAPI 在 webman 中的一键配置启用方案,基于 zircote/swagger-php 实现。

该组件提供了一种简便的方式来为 webman 应用生成和展示 API 文档,支持通过注解或属性(Attribute)方式定义 API 接口,并自动生成对应的 OpenAPI 文档和 Swagger UI 界面。

功能特性

安装

核心组件

Swagger 主类

Swagger 是主要入口,提供 registerGlobalRoute() 注册全局路由和 registerRoute() 注册自定义路由两个方法。

配置 DTO

ConfigRegisterRouteDTO

路由注册配置,控制路由注册行为,包含启用开关(enable)、路由前缀(route_prefix)、访问权限控制(host_forbidden)、Basic 认证(basic_auth)、Swagger UI 配置(swagger_ui)、OpenAPI 文档配置(openapi_doc)、是否注册 webman 路由(register_route)及额外中间件(middlewares)。

ConfigBasicAuthDTO

Basic 认证配置,默认关闭。启用后访问 Swagger UI 和 OpenAPI 文档时需要提供用户名和密码。支持配置用户名(username)、密码(password)和认证提示域(realm)。

ConfigOpenapiDocDTO

OpenAPI 文档配置,默认输出版本为 OpenAPI 3.1.0,支持扫描目录(scan_path)、排除目录(scan_exclude)、文档格式(format,yaml/json)、运行时动态修改回调(modify)、缓存键(cache_key)及 Schema 相关配置。

ConfigSwaggerUiDTO

Swagger UI 配置,支持自定义视图(view)、视图路径(view_path)、静态资源基础 URL(assets_base_url)及视图数据(data)。

ConfigHostForbiddenDTO

主机访问限制配置,支持启用开关(enable)、允许内网访问(ip_white_list_intranet)、IP 白名单(ip_white_list)及主机白名单(host_white_list)。默认仅允许内网环境访问。

OpenapiController

OpenapiController 负责处理文档展示,提供 swaggerUI() 展示 Swagger UI 界面和 openapiDoc() 返回 OpenAPI 文档内容两个动作。

Reader 路由注解解析

Reader 用于解析 OpenAPI 注解并生成路由配置。

SchemaConstants 常量定义

SchemaConstants 定义了用于 Schema 的扩展常量,包括 X_NAME(命名路由)、X_PATH(路由路径)、X_MIDDLEWARE(路由中间件)、X_SCHEMA_REQUEST(请求 Schema)、X_SCHEMA_RESPONSE(响应 Schema)。

参考示例

AI 辅助


All versions of swagger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
webman-tech/dto Version ^5.0 || dev-main
webman-tech/common-utils Version ^5.0 || dev-main
zircote/swagger-php Version ^6.3
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 webman-tech/swagger contains the following files

Loading the files please wait ...