PHPackages                             iayoo/apidoc-generate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. iayoo/apidoc-generate

ActiveLibrary[API Development](/categories/api)

iayoo/apidoc-generate
=====================

laravel api response

00PHP

Since Dec 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/iayoo/apidoc-generate)[ Packagist](https://packagist.org/packages/iayoo/apidoc-generate)[ RSS](/packages/iayoo-apidoc-generate/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

API Doc generate
================

[](#api-doc-generate)

===========================

api-doc-generate 是一个根据框架路由定义文件生成接口文档的php工具。

目前支持的框架有 `thinkphp`

thinkphp 使用
-----------

[](#thinkphp-使用)

### 安装

[](#安装)

```
composer require iayoo/apidoc-generate

```

### 使用

[](#使用)

在控制器入口加入注释

```
class Index
{
    /**
     * admin-v1-index
     * @title 登录
     * @validate app\admin\validate\TestValidate.login
     */
    public function login(){

    }
}
```

给成员方法注释用来解析接口内容

- title 接口标题
- validate 验证类：验证类名.场景

验证类定义如下：

```
namespace app\admin\validate;

use Iayoo\ApidocGenerate\provider\thinkphp\ApiDocValidate;

class TestValidate extends ApiDocValidate
{
    protected $rule = [
        'account'=>'require',
        'password'=>'require',
    ];

    protected $field = [
        'account'=>'账号',
        'password'=>'密码'
    ];

    protected $message = [
        'account.require'=>'账号不能为空',
        'password.require'=>'密码不能为空'
    ];

    protected $scene = [
        'login' => ['account','password'],
    ];
}
```

其中的 `field` 定义的就是 `postman` 文件中的请求参数名

`Validate` 必须继承 `Iayoo\ApidocGenerate\provider\thinkphp\ApiDocValidate`

`Iayoo\ApidocGenerate\provider\thinkphp\ApiDocValidate` 继承了thinkphp 框架的 `Validate`

### 生成文件

[](#生成文件)

在 `config/console.php` 配置文件中加入以下配置

```
return [
    'api-doc'=>\Iayoo\ApidocGenerate\provider\thinkphp\ApiDocGenerateCommand::class
];
```

命令行执行 `php think api-doc`

执行完成后会在项目根目录生成 `api-dco.postman-*.json` 的 `json` 文件。

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/28df4c2b32e952b2e8111a2a8d527193e496ef05f467c83475c502b17764e5cd?d=identicon)[iayoo](/maintainers/iayoo)

---

Top Contributors

[![iayoo](https://avatars.githubusercontent.com/u/29270812?v=4)](https://github.com/iayoo "iayoo (15 commits)")

### Embed Badge

![Health badge](/badges/iayoo-apidoc-generate/health.svg)

```
[![Health](https://phpackages.com/badges/iayoo-apidoc-generate/health.svg)](https://phpackages.com/packages/iayoo-apidoc-generate)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
