{"id":14971261,"url":"https://github.com/craa/yii2-api-debugger","last_synced_at":"2025-10-26T15:30:22.286Z","repository":{"id":56958504,"uuid":"66157818","full_name":"craa/yii2-api-debugger","owner":"craa","description":"api-debugger for Yii2","archived":false,"fork":false,"pushed_at":"2019-04-10T00:32:51.000Z","size":207,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T20:55:49.378Z","etag":null,"topics":["composer","php","yii","yii2-api-debugger"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-20T16:54:35.000Z","updated_at":"2021-01-04T03:25:56.000Z","dependencies_parsed_at":"2022-08-21T09:50:19.004Z","dependency_job_id":null,"html_url":"https://github.com/craa/yii2-api-debugger","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craa%2Fyii2-api-debugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craa%2Fyii2-api-debugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craa%2Fyii2-api-debugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craa%2Fyii2-api-debugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craa","download_url":"https://codeload.github.com/craa/yii2-api-debugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238347892,"owners_count":19457012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","php","yii","yii2-api-debugger"],"created_at":"2024-09-24T13:44:56.342Z","updated_at":"2025-10-26T15:30:21.837Z","avatar_url":"https://github.com/craa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yii2 API Debugger\n\n**Yii2-API-Debugger** 是Yii2框架下支持自动生成文档的API调试模块，使用 **ReflectionClass** 与 **BootStrap**，通过提取`module``controller``action`的注释生成API菜单和文档，并且自动构建当前API请求表单，调试人员可以修改参数调用并查看返回结果。\n\n\n\n## 安装\n\n- composer\n```bash\ncomposer require \"craa/yii2-api-debugger\" \"~1.0.0\"\n```\n\n- 手动安装\n\n```php\nYii::setAlias('@craa/ApiDebugger', '@app/yourpath/craa/api-debugger');\n```\n## 配置\n\n```php\nreturn [\n    //...\n    'modules' =\u003e [\n        'api-debugger' =\u003e [\n            'class' =\u003e 'craa\\ApiDebugger\\Module',\n            'name' =\u003e '接口调试系统',\n            'password' =\u003e '123',\n            'allowedIPs' =\u003e ['*'],\n            'baseModuleDir' =\u003e '@app',\n            'baseModuleNamespace' =\u003e '\\app',\n            'view' =\u003e '@craa/ApiDebugger/views/default/index',\n            'links' =\u003e [\n                [\n                    'text' =\u003e '\u003cb\u003eWIKI\u003c/b\u003e',\n                    'url' =\u003e 'http://github.com/craa/yii2-api-debugger',\n                    'options' =\u003e [\n                        'target' =\u003e '_blank',\n                    ]\n                ],\n            ],\n            'platforms' =\u003e [\n                'iOS',\n            ],\n            'versions' =\u003e [\n                '1.0.0',\n            ]\n        ],\n    ]\n];\n```\n\n然后就可以通过以下URL访问 API-Debugger:\n\n```\nhttp://localhost/path/to/index.php?r=api-debugger\n```\n\n## 注释规范\n**Yii2-API-Debugger** 是建立在规范的注释上的，在使用前先了解一下支持的注释。\n\n### Module\n**Yii2-API-Debugger** 会从`Module`的注释中提取以下值：\n\n- **name** 模块名称，如不填默认值为模块id\n- **enable** 是否开启，设置为 'false' 时模块以及属下的接口将不会在菜单显示\n\n示例：\n\n```php\n/**\n * common module definition class\n * @name 公共模块\n * @enable true\n */\nclass Module extends \\yii\\base\\Module\n```\n\n### Controller\n**Yii2-API-Debugger** 会从`Controller`的注释中提取以下值：\n\n- **name** 控制器名称，如不填默认值为控制器id\n- **enable** 是否开启，设置为 'false' 时控制器以及属下的接口将不会在菜单显示\n\n示例：\n\n```php\n/**\n * Default controller for the `common` module\n * @name 默认控制器\n * @enable true\n */\nclass DefaultController extends Controller\n```\n\n### Action\n**Yii2-API-Debugger** 会从`Action`的注释中提取以下值：\n\n- **name** 接口名称，如不填默认值为ActionId\n- **enable** 是否开启，设置为 'false' 时接口将不会在菜单显示\n- **method** 接口请求方式，`GET`/`POST`\n- **version** 支持版本，语法参考 [Composer Versions](https://getcomposer.org/doc/articles/versions.md)\n- **function** 接口功能描述\n- **param** 接口参数，该值可重复添加\n\n    格式为`@param string $uid 用户ID (123) 某某平台用户ID，10位字符串`\n    - *参数类型*：必填，例:`string`\n        - -file- 上传文件\n        - int 上传文本\n        - string 上传文本\n    - *参数名称*：必填，例:`$uid`\n    - *参数简介*：选填，例:`'用户ID`   \n    - *默认值*：小括号里的值为参数默认值，选填，例:`(123)`\n    - *参数详情*：选填，例:`'某某平台用户ID，10位字符串`\n\n\n- **return** 接口返回值描述，支持多行\n- **exception** 接口异常信息描述，支持多行\n\n示例：\n\n```php\n    /**\n     * @name 上传用户基本信息\n     * @enable true\n     * @method POST\n     * @version \u003e=2.1.0\n     * @function 上传平台用户信息\n     * @param int $uid [100] 用户ID XX平台用户ID\n     * @param string $sid 会话ID\n     * @param string $name 姓名\n     * @param int $age 年龄 \n     * @param -file- $headImg 头像 上传用户头像\n     * @param string steps json字符串 \n     * @param string userList json字符串 \n     * @paramDetail\n     * ===steps json字符串\n     * string title 审批节点名称\n     * string approver_id 审批用户id\n     * string sort 审批步骤\n     * ===userList json字符串\n     * string name 姓名\n     * string sex 性别\n     * int sort 排序\n     * @return\n     * ===data\n     * string uid 用户id\n     * int sex 用户性别\n     * array recordList 购物清单\n     * ===recordList\n     * int orderId 订单id\n     * string ctime 购物时间\n     * @exception\n     */\n     */\n    public function actionUpdateInfo()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraa%2Fyii2-api-debugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraa%2Fyii2-api-debugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraa%2Fyii2-api-debugger/lists"}