{"id":19217563,"url":"https://github.com/qq15725/ddoc","last_synced_at":"2025-05-13T00:11:39.031Z","repository":{"id":57083042,"uuid":"102577387","full_name":"qq15725/ddoc","owner":"qq15725","description":"支持 Laravel/Lumen 下控制器注释生成API文档，生成数据库字典, 注册路由呈现","archived":false,"fork":false,"pushed_at":"2022-11-03T05:27:30.000Z","size":211,"stargazers_count":27,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T06:17:18.896Z","etag":null,"topics":["api-document-generation","ddoc","laravel","lumen"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qq15725.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-06T07:30:29.000Z","updated_at":"2024-07-09T09:50:16.000Z","dependencies_parsed_at":"2023-01-21T11:46:49.165Z","dependency_job_id":null,"html_url":"https://github.com/qq15725/ddoc","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/qq15725%2Fddoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qq15725%2Fddoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qq15725%2Fddoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qq15725%2Fddoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qq15725","download_url":"https://codeload.github.com/qq15725/ddoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843219,"owners_count":21972874,"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":["api-document-generation","ddoc","laravel","lumen"],"created_at":"2024-11-09T14:22:49.234Z","updated_at":"2025-05-13T00:11:38.995Z","avatar_url":"https://github.com/qq15725.png","language":"PHP","readme":"支持 Laravel/Lumen 下控制器注释生成API文档，生成数据库字典, 注册路由呈现\n\n## 安装\n    \n```\ncomposer require wxm/ddoc --dev\n```\n\n## 配置\n\n### Laravel\n\n1. 注册 ServiceProvider (laravel 5.5 不需要注册):\n    ```php\n    Wxm\\DDoc\\DDocServiceProvider::class\n    ```\n    \n2. 发布配置：\n    ```shell\n    php artisan vendor:publish --provider=\"Wxm\\DDoc\\DDocServiceProvider\" --force\n    ```\n    \n### Lumen\n\n1. 注册 ServiceProvider:\n   \n    `bootstrap/app.php` 下添加\n\n    ```php\n    // 本地环境注册\n    if ($app-\u003eenvironment('local')) {\n        $app-\u003eregister(Wxm\\DDoc\\DDocServiceProvider::class);\n    }\n    ``` \n2. 手动复制配置文件\n    \n## 使用\n\n1. 开启服务器:\n    ```shell\n    php artisan serve\n    ```\n\n2. 访问 `http://localhost:8000/ddoc`\n\n## 接口注释 生成文档\n\n```php\n/**\n * @Resource(\"登录令牌\", uri=\"/token\")\n */\nclass AuthController extends Controller\n{\n    /**\n     * 获取令牌\n     *\n     * \u003e 通过手机号和密码获取会话`token`即登录凭证.\n     * \u003e 需要认证的请求请携带此 Authorization 头\n     * \u003e\n     * \u003e Authorization：Bearer {token}\n     * \u003e \n     *\n     * @Post(\"/\")\n     * @Versions({\"v1\"})\n     * @Response(200, body={\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkueHkudGVzdFwvc2Vzc2lvbiIsImlhdCI6MTU0NTIxNjM5OSwiZXhwIjoxNTQ1MjE5OTk5LCJuYmYiOjE1NDUyMTYzOTksImp0aSI6Im9pZjV4WTNqS2JkbEhzVmQiLCJzdWIiOjEsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.p3oAVkAxSCxTug5s6168N-ccfuCCywGDFiJ0b9zCXq8\",\"token_type\":\"bearer\",\"expires_in\":3600})\n     * @Parameters({\n     *      @Parameter(\"phone\", type=\"integer\", required=true, description=\"手机号.\"),\n     *      @Parameter(\"password\", type=\"string\", required=true, description=\"密码.\"),\n     * })\n     */\n    public function login()\n    {\n\n    }\n\n    /**\n     * 销毁当前令牌\n     *\n     * * 权限要求：`登录用户`\n     *\n     * \u003e 销毁成功返回 `204` 无内容 Http code\n     *\n     * @Delete(\"/\")\n     * @Versions({\"v1\"})\n     * @Response(204)\n     */\n    public function logout()\n    {\n\n    }\n\n    /**\n     * 刷新获取新令牌\n     *\n     * * 权限要求：`登录用户`\n     *\n     * \u003e 销毁当前令牌，获取新令牌\n     *\n     * @Put(\"/\")\n     * @Versions({\"v1\"})\n     * @Response(200, body={\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkueHkudGVzdFwvdG9rZW4iLCJpYXQiOjE1NDUyOTY3MzcsImV4cCI6MTU0NTMwMDM2NywibmJmIjoxNTQ1Mjk2NzY3LCJqdGkiOiI5Rk43TGJxZUlBc1JmZVRwIiwic3ViIjoxLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.qBCL-EfGYRnlxPZerpHpD9HVumjf89fVa2CBoXoFSvI\",\"token_type\":\"bearer\",\"expires_in\":3600})\n     */\n    public function refresh()\n    {\n\n    }\n}\n```\n\n## 配置 nginx 身份验证\n\n设置账号密码\n\n```shell\nprintf \"账号:$(openssl passwd -crypt 密码)\\n\" \u003e\u003e .htpasswd\n```\n\n配置 nginx\n\n```nginx\nlocation ~ /ddoc/ {\n  auth_basic \"Authorized users only\";\n  auth_basic_user_file .htpasswd;\n  try_files $uri /index.php?$query_string;\n}\n```\n\n参考 [API Blueprint Documentation](https://github.com/dingo/api/wiki/API-Blueprint-Documentation).\n\n## 参考图\n\n![](http://res.fdota.com/github/1548414878647.jpg)\n![](http://res.fdota.com/github/1548414898458.jpg)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqq15725%2Fddoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqq15725%2Fddoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqq15725%2Fddoc/lists"}