PHPackages                             yunbuye/thinkphp-apidoc-generator - 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. yunbuye/thinkphp-apidoc-generator

ActiveLibrary[API Development](/categories/api)

yunbuye/thinkphp-apidoc-generator
=================================

Generate beautiful API documentation from your ThinkPHP application

0.9.0(6y ago)5892MITPHPPHP &gt;=5.6.0

Since Dec 1Pushed 6y ago2 watchersCompare

[ Source](https://github.com/yunbuye/thinkphp-apidoc-generator)[ Packagist](https://packagist.org/packages/yunbuye/thinkphp-apidoc-generator)[ Docs](http://github.com/yunbuye/thinkphp-apidoc-generator)[ RSS](/packages/yunbuye-thinkphp-apidoc-generator/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (13)Used By (0)

ThinkPHP api文档自动生成
==================

[](#thinkphp-api文档自动生成)

支持
--

[](#支持)

thinkphp5.1.\*

自动生成的效果
-------

[](#自动生成的效果)

[![效果](resources/images/example.png)](resources/images/example.png)

安装
--

[](#安装)

1. 安装依赖 ```
    composer require yunbuye/thinkphp-apidoc-generator --dev
    ```
2. 添加命令
    打开配置文件 application/command.php 添加如下内容 ```
    return [
        //...其他命令
        "api-doc:generate"=>Yunbuye\ThinkApiDoc\Commands\GenerateDocumentation::class
    ];
    ```

使用
--

[](#使用)

1. 复制语言文件
    将 vendor/yunbuye/thinkphp-apidoc-generator/resources/lang/zh-cn.php 文件复制到 application/lang/zh-cn.php 。
    不复制的话，将会没有对应的描述。
2. 运行命令 生成文档 ```
     php think api-doc:generate --routePrefix=*
    ```
3. 其他参数
    运行下面命令查看 ```
        php think api-doc:generate -h
    ```

功能
--

[](#功能)

1. 分组

    - 在控制器头部,其他注释之后添加注释 @resource 拥有下面注释的控制器的操作都会会分到 例子 的这个组里

    ```
    /**
    * 其他注释后，空行
    *
    * @resource 例子分组，分组名称后必须空行
    *
    */
    class MessagesController
    ```
2. 控制器操作 操作的文档生成说明

    ```
    /**
    * 控制器标题，标题后必须有一个空行
    *
    * 其他描述备注，必须与标题隔开一行
    *
    */
    ```

    例子

    ```
     /**
      * 某接口名称
      *
      * 文本描述，或者其他描述，比如json
      * {
      *      company_id: '必传',
      *      sale_desc: '按销量降序',
      *      price_desc: '按价格降序',
      *      price_asc: '按价格升序'
      *  }
      * @param string $name
      * @return string
      */
    ```
3. 请求参数自动生成
    在控制器操作里，依赖注入请求验证，会自动生成参数文档。
    但是表单验证类，必须继承 Yunbuye\\ThinkApiDoc\\FormValidate 而且必须在控制器方法内注入。
    例：（其中 app\\common\\validate\\Save 继承了 Yunbuye\\ThinkApiDoc\\FormValidate）

    ```
         /**
        * 创建公司
        *
        * 创建后，需要设置接收通知的职员
        */
      public function save(app\common\validate\Save $validate)
         {

        }

    ```

    这样生成文档时，即可自动根据表单验证生成参数说明
4. 自定义错误信息（描述）
    生成文档时，如果对应规则有自定义错误信息，将会被使用。

Thanks
------

[](#thanks)

License
-------

[](#license)

MIT license.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~19 days

Total

11

Last Release

2230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1d5aa6e1769a531d3d4cbfd980198fddb57bce6f21bf343faf477b8fc0d3699?d=identicon)[yunbuye](/maintainers/yunbuye)

---

Top Contributors

[![xwpd](https://avatars.githubusercontent.com/u/17465049?v=4)](https://github.com/xwpd "xwpd (9 commits)")

---

Tags

apidocumentationthinkphp

### Embed Badge

![Health badge](/badges/yunbuye-thinkphp-apidoc-generator/health.svg)

```
[![Health](https://phpackages.com/badges/yunbuye-thinkphp-apidoc-generator/health.svg)](https://phpackages.com/packages/yunbuye-thinkphp-apidoc-generator)
```

###  Alternatives

[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[mpociot/laravel-apidoc-generator

Generate beautiful API documentation from your Laravel application

3.5k3.1M12](/packages/mpociot-laravel-apidoc-generator)

PHPackages © 2026

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