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

swagger openapi 在 webman 中一键配置启用

安装

特点

使用

零配置

安装完依赖后打开 /openapi 即可访问 swagger 文档

默认扫描整个 app_path()

之后在 Controller 写对应的注解即可,参考 zircote/swagger-php petstore.swagger.io

修改 @OA\Info 等全局的配置

第一种:通过添加注释的方式修改

第二种:通过 modify 的方式修改(建议:因为这种方式支持更加复杂和动态的配置)

以下 openapi_doc 支持配置在 全局 和 应用级别(见 配置说明)

限制访问

为了保证接口文档的安全性,不应该让接口暴露在公网环境下

默认 host_forbidden 开启,仅内网环境下可访问,见 HostForbiddenMiddleware

可以通过配置 app.php 中的 host_forbidden enable => false 来全局关闭

多应用支持

默认通过配置 app.php 中的 global_route 配置会启用全局的扫描 app_path() 的文档, 可以通过设置 enable => false 来关闭

在需要的地方通过 (new Swagger())->registerRoute() 来手动注册文档路由

如:

如此配置,支持通过 /api1/openapi 访问 api1 的文档,/api2/my-doc 访问 api2 的文档

配置说明

很多配置都支持全局(多应用共享)、应用级别(仅当前应用生效)

app.php 中的配置是全局的

(new Swagger())->registerRoute($config) 中的传参 $config 是应用级别的

webman 路由自动注册

在 config 的 app.php 中修改 register_webman_route 为 true 即可自动注册 webman 路由

路由传参与 swagger 文档绑定,并且支持自动校验(仅支持 php>=8.1)

建立一个 Schema

控制器

参考

webman 使用 swagger 示例:注解模式的 crud

webman 使用 swagger 示例:多 swagger 文档


All versions of swagger with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-json Version *
zircote/swagger-php Version ^4.7
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 ....