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

ActiveYii2-extension[API Development](/categories/api)

junguo/yii2-apidoc
==================

\[重大更新!\]适合中小型公司使用.可作为调试工具(postman),可作为文档.简单配置,不切入系统.一切以提高开发效率,提高生产力为基准

2.5.3(7y ago)6761Apache-2.0PHP

Since Apr 17Pushed 7y agoCompare

[ Source](https://github.com/ivlucks/apidoc)[ Packagist](https://packagist.org/packages/junguo/yii2-apidoc)[ RSS](/packages/junguo-yii2-apidoc/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (24)Used By (0)

项目描述
----

[](#项目描述)

```
1、增加redis,加快解析速度
2、自定义域名,文档,api分开
3、自定义app路径,
4、增加令牌,方便测试,过期再生成,自动保存
5、极简参数
6、开放权限下降class,method.mould无需标注
7、继承类的方法需要显式标注才显示
8、删除bootstrap,不再因加载困扰

```

安装
--

[](#安装)

composer require junguo/yii2-apidoc

访问
--

[](#访问)

直接访问项目地址根目录即可。登录默认密码：123456

准备
--

[](#准备)

1、请确保yii2开启了url美化功能，

```
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
    ],
],
```

2、需要安装好redis

```
    "yiisoft/yii2-redis": "^2.0.9"
```

项目配置：
-----

[](#项目配置)

将下方配置引入入口文件main-local.php或按照项目配置文件( 正式环境不要引入）：

```
$config['modules']['apidoc'] = [
    'class'=>'junguo\apidoc\Module',
    'password'=>'123456',
    'ipFilters'=>['*','::1'],
    'domain'=>'api.xxx.com',//测试api域名,一般文档和api不在同一域名下.api index.php头部添加header('access-Control-Allow-Origin:*'); ,否则会出现跨域问题
    'tokenname'=>'access-token', // 令牌键值
     'apppath' => 'api',      //api模块路径
    'token_type' => '1',      //令牌以明文方式上传,其他参数见文档,默认1
    'ctrs' =>['controllers'], //  apppath下其他Controller 路径
];
```

### \['modules'\]\['apidoc'\]配置说明：

[](#modulesapidoc配置说明)

注释参数作用备注class模块入口password登录模块的密码ipFiltersIP登录限制apppathapi模块路径ctrsapi下根controllers,可多个tokenname测试时使用.domain实际api的请求域名 不是同一域名下要注意跨域问题 在API的index.php文件添加 header('access-Control-Allow-Origin:\*');token\_type令牌上传方式,默认1 , 2 post参数形式 3 header Bearer 1 明文url参数追加Phpstrom 注释配置：
--------------

[](#phpstrom-注释配置)

打开phpstrom-&gt;setting-&gt;Editor-&gt;File and Code Templates-&gt;Includes，将两个文件内容替换原本的文件内容,点击apply即可

### 配置文件：

[](#配置文件)

PHP Function Doc Comment

```
/**
#if (${NAME.indexOf('action')} != '-1' && ${NAME}!='actions')
@brief 接口名称
@param type $name 描述
@method POST/GET
@detail 接口描述
@return array
@throws Null
#end
${PARAM_DOC}
#if (${TYPE_HINT} != "void") * @return ${TYPE_HINT}
#end
${THROWS_DOC}
*/

```

PHP Class Doc Comment

```
/**
 * Class ${NAME}
#if (${NAMESPACE}) * @package ${NAMESPACE}
#end
#eif (${NAME.indexOf('Controller')}!=-1)
@brief controller名称
#end
 */

```

检查phpstorm配置
------------

[](#检查phpstorm配置)

使用apidoc编写程序注释
--------------

[](#使用apidoc编写程序注释)

1、方法注释规范如下：

注释参数作用备注brief标明方法名称，将会显示在页面左方param需要传入的参数method调用方法，POST/GETreturn返回参数，将会显示在页面右方throws异常声明，将会显示在页面右方detail接口说明，将会显示在页面右方api-disable接口说明，默认显示,如显式增加为隐藏class或者methodext-enable接口说明，默认隐藏继承类的method,如无显式标注不显示, 多个method逗号分隔,无需加action示例：
---

[](#示例)

先配置好phpstome注释配置。 1、配置controller类的注释 2、配置action的注释

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Total

23

Last Release

2572d ago

Major Versions

1.3.6.9 → 2.02019-04-20

### Community

Maintainers

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

---

Top Contributors

[![ivlucks](https://avatars.githubusercontent.com/u/6069588?v=4)](https://github.com/ivlucks "ivlucks (6 commits)")

---

Tags

apidocyii2php exlanatory

### Embed Badge

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

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

###  Alternatives

[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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