PHPackages                             wxm/ddoc - 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. [Database &amp; ORM](/categories/database)
4. /
5. wxm/ddoc

ActiveLibrary[Database &amp; ORM](/categories/database)

wxm/ddoc
========

基于 laravel 框架, 读取数据库信息生成数据库字典, 通过控制器注释生成API接口文档, 注册 ddoc 路由网页形式呈现

v2.0.4(3y ago)271.0k↓100%10MITPHPPHP &gt;=7.1.3

Since Sep 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/qq15725/ddoc)[ Packagist](https://packagist.org/packages/wxm/ddoc)[ Docs](https://github.com/qq15725/ddoc)[ RSS](/packages/wxm-ddoc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (8)Used By (0)

支持 Laravel/Lumen 下控制器注释生成API文档，生成数据库字典, 注册路由呈现

安装
--

[](#安装)

```
composer require wxm/ddoc --dev

```

配置
--

[](#配置)

### Laravel

[](#laravel)

1. 注册 ServiceProvider (laravel 5.5 不需要注册):

    ```
    Wxm\DDoc\DDocServiceProvider::class
    ```
2. 发布配置：

    ```
    php artisan vendor:publish --provider="Wxm\DDoc\DDocServiceProvider" --force
    ```

### Lumen

[](#lumen)

1. 注册 ServiceProvider:

    `bootstrap/app.php` 下添加

    ```
    // 本地环境注册
    if ($app->environment('local')) {
        $app->register(Wxm\DDoc\DDocServiceProvider::class);
    }
    ```
2. 手动复制配置文件

使用
--

[](#使用)

1. 开启服务器:

    ```
    php artisan serve
    ```
2. 访问 `http://localhost:8000/ddoc`

接口注释 生成文档
---------

[](#接口注释-生成文档)

```
/**
 * @Resource("登录令牌", uri="/token")
 */
class AuthController extends Controller
{
    /**
     * 获取令牌
     *
     * > 通过手机号和密码获取会话`token`即登录凭证.
     * > 需要认证的请求请携带此 Authorization 头
     * >
     * > Authorization：Bearer {token}
     * >
     *
     * @Post("/")
     * @Versions({"v1"})
     * @Response(200, body={"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkueHkudGVzdFwvc2Vzc2lvbiIsImlhdCI6MTU0NTIxNjM5OSwiZXhwIjoxNTQ1MjE5OTk5LCJuYmYiOjE1NDUyMTYzOTksImp0aSI6Im9pZjV4WTNqS2JkbEhzVmQiLCJzdWIiOjEsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.p3oAVkAxSCxTug5s6168N-ccfuCCywGDFiJ0b9zCXq8","token_type":"bearer","expires_in":3600})
     * @Parameters({
     *      @Parameter("phone", type="integer", required=true, description="手机号."),
     *      @Parameter("password", type="string", required=true, description="密码."),
     * })
     */
    public function login()
    {

    }

    /**
     * 销毁当前令牌
     *
     * * 权限要求：`登录用户`
     *
     * > 销毁成功返回 `204` 无内容 Http code
     *
     * @Delete("/")
     * @Versions({"v1"})
     * @Response(204)
     */
    public function logout()
    {

    }

    /**
     * 刷新获取新令牌
     *
     * * 权限要求：`登录用户`
     *
     * > 销毁当前令牌，获取新令牌
     *
     * @Put("/")
     * @Versions({"v1"})
     * @Response(200, body={"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkueHkudGVzdFwvdG9rZW4iLCJpYXQiOjE1NDUyOTY3MzcsImV4cCI6MTU0NTMwMDM2NywibmJmIjoxNTQ1Mjk2NzY3LCJqdGkiOiI5Rk43TGJxZUlBc1JmZVRwIiwic3ViIjoxLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.qBCL-EfGYRnlxPZerpHpD9HVumjf89fVa2CBoXoFSvI","token_type":"bearer","expires_in":3600})
     */
    public function refresh()
    {

    }
}
```

配置 nginx 身份验证
-------------

[](#配置-nginx-身份验证)

设置账号密码

```
printf "账号:$(openssl passwd -crypt 密码)\n" >> .htpasswd
```

配置 nginx

```
location ~ /ddoc/ {
  auth_basic "Authorized users only";
  auth_basic_user_file .htpasswd;
  try_files $uri /index.php?$query_string;
}
```

参考 [API Blueprint Documentation](https://github.com/dingo/api/wiki/API-Blueprint-Documentation).

参考图
---

[](#参考图)

[![](https://camo.githubusercontent.com/fed5b6d508718fd883af47efa5dc9eac2c37d00fffe311e50aefa37f5b6c0b70/687474703a2f2f7265732e66646f74612e636f6d2f6769746875622f313534383431343837383634372e6a7067)](https://camo.githubusercontent.com/fed5b6d508718fd883af47efa5dc9eac2c37d00fffe311e50aefa37f5b6c0b70/687474703a2f2f7265732e66646f74612e636f6d2f6769746875622f313534383431343837383634372e6a7067)[![](https://camo.githubusercontent.com/e021b7934e76797bf6329493b059b1eacdcda6b59c12e0a7969a7edaefad9206/687474703a2f2f7265732e66646f74612e636f6d2f6769746875622f313534383431343839383435382e6a7067)](https://camo.githubusercontent.com/e021b7934e76797bf6329493b059b1eacdcda6b59c12e0a7969a7edaefad9206/687474703a2f2f7265732e66646f74612e636f6d2f6769746875622f313534383431343839383435382e6a7067)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

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

Recently: every ~344 days

Total

7

Last Release

1284d ago

Major Versions

v1.0.1 → v2.0.02019-01-25

PHP version history (2 changes)v1.0PHP ^5.5.9 || ^7.0

v2.0.0PHP &gt;=7.1.3

### Community

Maintainers

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

---

Top Contributors

[![qq15725](https://avatars.githubusercontent.com/u/19576382?v=4)](https://github.com/qq15725 "qq15725 (48 commits)")

---

Tags

api-document-generationddoclaravellumenapilaraveldatabasedoc

### Embed Badge

![Health badge](/badges/wxm-ddoc/health.svg)

```
[![Health](https://phpackages.com/badges/wxm-ddoc/health.svg)](https://phpackages.com/packages/wxm-ddoc)
```

###  Alternatives

[kreait/laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

1.3k16.5M42](/packages/kreait-laravel-firebase)[laravel-doctrine/fluent

A fluent PHP mapping driver for Doctrine2.

43430.3k13](/packages/laravel-doctrine-fluent)[renoki-co/l1

Laravel integration for Cloudflare Workers services.

16113.1k](/packages/renoki-co-l1)[williarin/wordpress-interop

Interoperability library to work with WordPress database in third party apps

6610.9k2](/packages/williarin-wordpress-interop)[sarfraznawaz2005/indexer

Laravel package to monitor SELECT queries and offer best possible INDEX fields.

562.7k](/packages/sarfraznawaz2005-indexer)

PHPackages © 2026

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