PHPackages                             craa/yii2-api-debugger - 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. craa/yii2-api-debugger

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

craa/yii2-api-debugger
======================

api-debugger extension for the Yii framework

1.0.5(8y ago)5701MITJavaScript

Since Aug 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/craa/yii2-api-debugger)[ Packagist](https://packagist.org/packages/craa/yii2-api-debugger)[ Docs](https://github.com/craa/yii2-api-debugger)[ RSS](/packages/craa-yii2-api-debugger/feed)WikiDiscussions master Synced 4w ago

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

Yii2 API Debugger
=================

[](#yii2-api-debugger)

**Yii2-API-Debugger** 是Yii2框架下支持自动生成文档的API调试模块，使用 **ReflectionClass** 与 **BootStrap**，通过提取`module``controller``action`的注释生成API菜单和文档，并且自动构建当前API请求表单，调试人员可以修改参数调用并查看返回结果。

安装
--

[](#安装)

- composer

```
composer require "craa/yii2-api-debugger" "~1.0.0"
```

- 手动安装

```
Yii::setAlias('@craa/ApiDebugger', '@app/yourpath/craa/api-debugger');
```

配置
--

[](#配置)

```
return [
    //...
    'modules' => [
        'api-debugger' => [
            'class' => 'craa\ApiDebugger\Module',
            'name' => '接口调试系统',
            'password' => '123',
            'allowedIPs' => ['*'],
            'baseModuleDir' => '@app',
            'baseModuleNamespace' => '\app',
            'view' => '@craa/ApiDebugger/views/default/index',
            'links' => [
                [
                    'text' => 'WIKI',
                    'url' => 'http://github.com/craa/yii2-api-debugger',
                    'options' => [
                        'target' => '_blank',
                    ]
                ],
            ],
            'platforms' => [
                'iOS',
            ],
            'versions' => [
                '1.0.0',
            ]
        ],
    ]
];
```

然后就可以通过以下URL访问 API-Debugger:

```
http://localhost/path/to/index.php?r=api-debugger

```

注释规范
----

[](#注释规范)

**Yii2-API-Debugger** 是建立在规范的注释上的，在使用前先了解一下支持的注释。

### Module

[](#module)

**Yii2-API-Debugger** 会从`Module`的注释中提取以下值：

- **name** 模块名称，如不填默认值为模块id
- **enable** 是否开启，设置为 'false' 时模块以及属下的接口将不会在菜单显示

示例：

```
/**
 * common module definition class
 * @name 公共模块
 * @enable true
 */
class Module extends \yii\base\Module
```

### Controller

[](#controller)

**Yii2-API-Debugger** 会从`Controller`的注释中提取以下值：

- **name** 控制器名称，如不填默认值为控制器id
- **enable** 是否开启，设置为 'false' 时控制器以及属下的接口将不会在菜单显示

示例：

```
/**
 * Default controller for the `common` module
 * @name 默认控制器
 * @enable true
 */
class DefaultController extends Controller
```

### Action

[](#action)

**Yii2-API-Debugger** 会从`Action`的注释中提取以下值：

- **name** 接口名称，如不填默认值为ActionId
- **enable** 是否开启，设置为 'false' 时接口将不会在菜单显示
- **method** 接口请求方式，`GET`/`POST`
- **version** 支持版本，语法参考 [Composer Versions](https://getcomposer.org/doc/articles/versions.md)
- **function** 接口功能描述
- **param** 接口参数，该值可重复添加

    格式为`@param string $uid 用户ID (123) 某某平台用户ID，10位字符串`

    - *参数类型*：必填，例:`string`
        - -file- 上传文件
        - int 上传文本
        - string 上传文本
    - *参数名称*：必填，例:`$uid`
    - *参数简介*：选填，例:`'用户ID`
    - *默认值*：小括号里的值为参数默认值，选填，例:`(123)`
    - *参数详情*：选填，例:`'某某平台用户ID，10位字符串`
- **return** 接口返回值描述，支持多行
- **exception** 接口异常信息描述，支持多行

示例：

```
    /**
     * @name 上传用户基本信息
     * @enable true
     * @method POST
     * @version >=2.1.0
     * @function 上传平台用户信息
     * @param int $uid [100] 用户ID XX平台用户ID
     * @param string $sid 会话ID
     * @param string $name 姓名
     * @param int $age 年龄
     * @param -file- $headImg 头像 上传用户头像
     * @param string steps json字符串
     * @param string userList json字符串
     * @paramDetail
     * ===steps json字符串
     * string title 审批节点名称
     * string approver_id 审批用户id
     * string sort 审批步骤
     * ===userList json字符串
     * string name 姓名
     * string sex 性别
     * int sort 排序
     * @return
     * ===data
     * string uid 用户id
     * int sex 用户性别
     * array recordList 购物清单
     * ===recordList
     * int orderId 订单id
     * string ctime 购物时间
     * @exception
     */
     */
    public function actionUpdateInfo()
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~106 days

Recently: every ~159 days

Total

7

Last Release

2960d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/00b659afcdbf5437e03331c722e404f42ad5a6c9be39a4ed6ffa40d6c93727a6?d=identicon)[craa](/maintainers/craa)

---

Top Contributors

[![craa](https://avatars.githubusercontent.com/u/8178776?v=4)](https://github.com/craa "craa (18 commits)")[![kaizhuQin](https://avatars.githubusercontent.com/u/4590307?v=4)](https://github.com/kaizhuQin "kaizhuQin (6 commits)")

---

Tags

composerphpyiiyii2-api-debuggerapiyii2api-debugger

### Embed Badge

![Health badge](/badges/craa-yii2-api-debugger/health.svg)

```
[![Health](https://phpackages.com/badges/craa-yii2-api-debugger/health.svg)](https://phpackages.com/packages/craa-yii2-api-debugger)
```

###  Alternatives

[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

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

PHPackages © 2026

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