Download the PHP package andphp/apidog without Composer

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

Api Watch Dog

fork https://github.com/daodao97/apidog 基于 hyperf3.0没有发布可使用版本 一个 Hyperf 框架的 Api 参数校验及 swagger 文档生成组件

  1. 根据注解自动进行Api参数的校验, 业务代码更纯粹.
  2. 根据注解自动生成Swagger文档, 让接口文档维护更省心.

在 1.2 版本后, 本扩展移除了内部自定义的验证器, 只保留的 hyperf 原生验证器, 以保持验证规则的统一

旧版本文档 查看

安装

使用

1. 发布配置文件

2. 修改配置文件

注意 与1.2及之前的版本相比, 配置文件结构及文件名 略有不同

(1) 配置文件结构的优化, 增加了swagger外的整体配置

(2) 配置文件的名称 由 swagger.php 改为 apidog.php

根据需求修改 config/autoload/apidog.php

3. 启用 Api参数校验中间件

4. 校验规则的定义

规则列表参见 hyperf/validation 文档

更详细的规则支持列表可以参考 laravel/validation 文档

扩展在原生的基础上进行了封装, 支持方便的进行 自定义校验控制器回调校验

实现思路

api参数的自动校验: 通过中间件拦截 http 请求, 根据注解中的参数定义, 通过 valiation 自动验证和过滤, 如果验证失败, 则拦截请求. 其中valiation 包含 规则校验, 参数过滤, 自定义校验 三部分.

swagger文档生成: 在php bin/hyperf.php start 启动 http-server 时, 通过监听 BootAppConfListener 事件, 扫码控制器注解, 通过注解中的 访问类型, 参数格式, 返回类型 等, 自动组装 swagger.json 结构, 最后输出到 config/autoload/apidog.php 定义的文件路径中

支持的注解

Api类型

GetApi, PostApi, PutApi, DeleteApi

参数类型

Header, Query, Body, FormData, Path

其他

ApiController, ApiResponse, ApiVersion, ApiServer, ApiDefinitions, ApiDefinition

ApiServer 当你在 config/autoload.php/server.php servers 中配置了多个 http 服务时, 如果想不同服务生成不同的swagger.json 可以在控制器中增加此注解.

ApiVersion 当你的统一个接口存在不同版本时, 可以使用此注解, 路由注册时会为每个木有增加版本号, 如上方代码注册的实际路由为 /v1/user/***

ApiDefinition 定义一个 Definition,用于Response的复用。 swagger 的difinition是以引用的方式来嵌套的,如果需要嵌套另外一个(值为object类型就需要嵌套了),可以指定具体 properties 中的 $ref 属性

ApiDefinitions 定义一个组Definition

ApiResponse 响应体的schema支持为key设置简介. $ref 属性可以引用 ApiDefinition 定义好的结构(该属性优先级最高)

具体使用方式参见下方样例

样例

Swagger UI启动

本组件提供了两种方式来启用SwaggerUI , 当config/autoload/apidog.php enable = true

方式一

系统启动时, swagger.json 会自动输出到配置文件中定义的 output_file中, 此时我们到swagger ui的前端文件结合nginx启动web服务

方式二

也可以使用组件提供的快捷命令, 快速启动一个 swagger ui.

hMvJnQ

Swagger展示

AOFVzI

更新日志


All versions of apidog with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-json Version *
hyperf/command Version 3.0.*
hyperf/http-server Version 3.0.*
hyperf/logger Version 3.0.*
hyperf/validation Version 3.0.*
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 andphp/apidog contains the following files

Loading the files please wait ....