PHPackages                             ibunao/yii2-apidoc - 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. ibunao/yii2-apidoc

ActiveLibrary[API Development](/categories/api)

ibunao/yii2-apidoc
==================

apidoc for yii

v0.0.5(7y ago)384PHPPHP &gt;=5.2

Since Jan 3Pushed 7y agoCompare

[ Source](https://github.com/echo-ding/yii-apidoc)[ Packagist](https://packagist.org/packages/ibunao/yii2-apidoc)[ Docs](https://github.com/echo-ding/yii-apidoc)[ RSS](/packages/ibunao-yii2-apidoc/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

### 安装

[](#安装)

```
composer require ibunao/yii2-apidoc
```

### 配置

[](#配置)

#### 配置到模块数组

[](#配置到模块数组)

假设我们要放到 `backend` 项目下

```
'modules' => [
    ...
    ...
    'document' => [
        'class' => 'ibunao\apidoc\Module',
        # 配置访问接口的host  通常配置 frontend 项目的域名
        'debugHost' => 'http://api.yiidoc.com',
        # 和配置时定义的模块名一致
        'moduleName' => 'document',
    ],
    ...
    ...
],
```

#### 配置需要接口文档的控制器

[](#配置需要接口文档的控制器)

```
return [
	'apiList' => [
		'test' => [
			'label' => '文档测试',
			'class' => 'frontend\controllers\ApidocController',
		],
		'test2' => [
			'label' => '文档测试2',
			'class' => 'frontend\controllers\Apidoc2Controller',
		],
	],
];
```

#### 表和静态资源

[](#表和静态资源)

剩下的需要设置的就是创建一个表用来存储文档编辑部分数据，还有就是将静态资源放到指定位置。相关文件放在 `vendor\ibunao\yii2-apidoc\source`

1. 需要创建表的sql看 `document_api.sql` 文件
2. 以配在 `backend` 项目为例，把 `css` 和 `js` 文件夹放在 `backend\web` 下

为什么不用资源发布和数据库迁移？
不想费劲

### 生成文档的备注格式

[](#生成文档的备注格式)

**@name表示接口名称，不注释则文档不显示该接口**

@uses表示接口简介/用途等，可空

@method表示请求方式，不注释默认为get

@param表示请求参数，可空可多个，后面分别跟类型、参数名，备注

@author表示接口作者/负责人，可空

```
/**
 * 注册步骤一：手机号获取验证码
 *
 * @name	获取注册验证码
 * @uses	用户注册是拉取验证码
 * @method	post
 * @param	string $phone 手机号
 * @author	echoding
 */
public function actionIndex()
{
    Yii::$app->response->format = 'json';
	return Yii::$app->request->post();
}
```

[![apidoc4](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc4.png)](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc4.png)

### 示例

[](#示例)

首页

[![apidoc3](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc3.png)](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc3.png)

可以编辑文档说明和示例

[![apidoc5](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc5.png)](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc5.png)

接口调试

[![apidoc6](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc6.png)](https://raw.githubusercontent.com/Ibunao/github-blog/master/images/yii/apidoc/apidoc6.png)

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

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 ~38 days

Total

4

Last Release

2615d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27016702?v=4)[ibunao](/maintainers/echo-ding)[@echo-ding](https://github.com/echo-ding)

---

Top Contributors

[![echo-ding](https://avatars.githubusercontent.com/u/27016702?v=4)](https://github.com/echo-ding "echo-ding (5 commits)")

---

Tags

apidoc

### Embed Badge

![Health badge](/badges/ibunao-yii2-apidoc/health.svg)

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

###  Alternatives

[hg/apidoc

根据注解生成API文档，兼容Laravel、ThinkPHP、Hyperf、Webman等框架；在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能

22090.3k1](/packages/hg-apidoc)

PHPackages © 2026

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