PHPackages                             tinymeng/api-doc-php - 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. tinymeng/api-doc-php

ActiveLibrary

tinymeng/api-doc-php
====================

api-doc-php

18HTML

Since Aug 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/majiameng/api-doc-php)[ Packagist](https://packagist.org/packages/tinymeng/api-doc-php)[ RSS](/packages/tinymeng-api-doc-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Api-Doc-PHP
===========

[](#api-doc-php)

### 主要功能：

[](#主要功能)

- 根据接口注释自动生成接口文档

### 演示地址

[](#演示地址)

[【Gitee Pages:】https://gitee.com/majiameng/api-doc-php](https://gitee.com/majiameng/api-doc-php)

### 开源地址：

[](#开源地址)

[【GigHub:】https://github.com/majiameng/api-doc-php](https://github.com/majiameng/api-doc-php)

### 扩展安装：

[](#扩展安装)

- 方法一：composer命令 `composer require tinymeng/api-doc-php  dev-master`
- 方法二：直接下载压缩包，然后进入项目中执行 composer命令 `composer update` 来生成自动加载文件

### 引用扩展：

[](#引用扩展)

- 当你的项目不支持composer自动加载时，可以使用以下方式来引用该扩展包

```
// 引入扩展（具体路径请根据你的目录结构自行修改）
require_once __DIR__ . '/vendor/autoload.php';

```

### 使用扩展：

[](#使用扩展)

```
// 引入扩展（具体路径请根据你的目录结构自行修改）
require_once __DIR__ . '/../vendor/autoload.php';
// 加载测试API类1
require_once __DIR__ . '/Api.php';
// 加载测试API类2
require_once __DIR__ . '/Api2.php';
$config = [
    'class'         => ['Api', 'Api2'], // 要生成文档的类
    'filter_method' => ['__construct'], // 要过滤的方法名称
];
$api = new \tinymeng\apidoc\BootstrapApiDoc($config);
$doc = $api->getHtml();
exit($doc);

```

访问：[http://localhost/index/doc即可访问到文档](http://localhost/index/doc%E5%8D%B3%E5%8F%AF%E8%AE%BF%E9%97%AE%E5%88%B0%E6%96%87%E6%A1%A3)

> 注意：Api.php控制器的方法里一定要有title，method等参数说明用来给文档提示说明文字，如果无，会报错

2、Api.php案例代码：

```
namespace app\index\controller;

use think\App;
use think\Controller;
use think\Db;

/**
 * @title API接口
 * @desc API接口
 * Class APi
 * @package app\index\controller
 */
class Api extends Controller
{
    /**
     * @title 获取所有栏目
     * @url /index/api/homecategory
     * @method POST
     * @code 200 成功
     * @code 201 失败
     * @return int status 状态码 （具体参见状态码说明）
     * @return string msg 提示信息
     */
    public function homecategory()
    {
        //... 你的代码
    }
}
```

### 具体效果可运行test目录下的`index.php`查看

[](#具体效果可运行test目录下的indexphp查看)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![majiameng](https://avatars.githubusercontent.com/u/24783993?v=4)](https://github.com/majiameng "majiameng (3 commits)")

### Embed Badge

![Health badge](/badges/tinymeng-api-doc-php/health.svg)

```
[![Health](https://phpackages.com/badges/tinymeng-api-doc-php/health.svg)](https://phpackages.com/packages/tinymeng-api-doc-php)
```

PHPackages © 2026

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