PHPackages                             liaosp/think-swagger - 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. liaosp/think-swagger

ActiveLibrary

liaosp/think-swagger
====================

thinkphp apidoc gen think-swagger swaggerv3

v1.0.2(4y ago)220MITPHP

Since Sep 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/liaoshengping/think-swagger)[ Packagist](https://packagist.org/packages/liaosp/think-swagger)[ RSS](/packages/liaosp-think-swagger/feed)WikiDiscussions master Synced 1w ago

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

 think-swagger
===============

[](#-think-swagger-)

[![](image.jpg)](image.jpg)

 thinkphp5 自动生成swagger文档 swagger-ui

[![Latest Stable Version](https://camo.githubusercontent.com/2315d044c4c9897ccb2651af3781d216495c6f3e83a598dfc0bee083c1e6ca93/68747470733a2f2f706f7365722e707567782e6f72672f6c69616f73702f7468696e6b2d737761676765722f762f737461626c65)](https://packagist.org/packages/liaosp/laravel-validate-ext)[![Total Downloads](https://camo.githubusercontent.com/231903fd2a40c8f85ce66da9e75da713d922d2d0ee5adf55e3995f6c60d650aa/68747470733a2f2f706f7365722e707567782e6f72672f6c69616f73702f7468696e6b2d737761676765722f646f776e6c6f616473)](https://packagist.org/packages/liaosp/laravel-validate-ext)[![Daily Downloads](https://camo.githubusercontent.com/7c2ca3cda39906fa9cf04e3a09e00cca47888e901409cbc5fc8f3f21819d9bd6/68747470733a2f2f706f7365722e707567782e6f72672f6c69616f73702f7468696e6b2d737761676765722f642f6461696c79)](https://packagist.org/packages/liaosp/laravel-validate-ext)[![License](https://camo.githubusercontent.com/bd0577dd88d6e1f092b936a5dc42656ff483ded5141298d00341e216c281b823/68747470733a2f2f706f7365722e707567782e6f72672f6c69616f73702f7468696e6b2d737761676765722f6c6963656e7365)](https://packagist.org/packages/liaosp/laravel-validate-ext)[![StyleCI](https://camo.githubusercontent.com/80453dbca2e64b853d5f4ac532214958140de4b89e17f0acebbaa29337c6443b/68747470733a2f2f7374796c6563692e696f2f7265706f732f35333136333430352f736869656c64)](https://styleci.io/repos/53163405/)

TP6 后续发布

Installing
----------

[](#installing)

```
$ composer require liaosp/think-swagger -vvv
```

Usage
-----

[](#usage)

安装好后，在application 下的任意文件写入：

```
     /**
      * @OA\Info(
      *      version="1.0.0",
      *      title="OpenApi",
      *      description="Swagger OpenApi description",
      *      @OA\Contact(
      *          email="darius@matulionis.lt"
      *      ),
      *     @OA\License(
      *         name="Apache 2.0",
      *         url="http://www.apache.org/licenses/LICENSE-2.0.html"
      *     )
      * )
      */

     /**
      * @OA\Get(
      *      path="/projects/{id}",
      *      operationId="getProjectById",
      *      tags={"Projects"},
      *      summary="Get project information",
      *      description="Returns project data",
      *      @OA\Parameter(
      *          name="id",
      *          description="Project id",
      *          required=true,
      *          in="path",
      *          @OA\Schema(
      *              type="integer"
      *          )
      *      ),
      *      @OA\Response(
      *          response=200,
      *          description="successful operation"
      *       ),
      *      @OA\Response(response=400, description="Bad request"),
      *      @OA\Response(response=404, description="Resource Not Found"),
      *      security={
      *         {
      *             "oauth2_security_example": {"write:projects", "read:projects"}
      *         }
      *     },
      * )
      */

```

访问：

> 你的域名/apidoc

[![](res.jpg)](res.jpg)

如果你想扫描指定的文件目录，在config/app.php 添加绝对路径

```
'swagger_path' =>'绝对路径 __DIR__ 自定义'

```

更多用法可参考我之前写的博客相关

[swagger 使用](https://liaosp.blog.csdn.net/article/details/119887281)

[如何写composer包](https://blog.csdn.net/qq_22823581/article/details/120035631)

[如何写这个包](https://blog.csdn.net/qq_22823581/article/details/120327505?spm=1001.2014.3001.5501)

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/liaosp/think-swagger/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/liaosp/think-swagger/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

3

Last Release

1703d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/440eb424aa6385a9bca5bf1597270a4235e943a67536900f7fbf0c8cdb96594e?d=identicon)[liaoshengping](/maintainers/liaoshengping)

---

Top Contributors

[![liaoshengping](https://avatars.githubusercontent.com/u/24541157?v=4)](https://github.com/liaoshengping "liaoshengping (6 commits)")

### Embed Badge

![Health badge](/badges/liaosp-think-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/liaosp-think-swagger/health.svg)](https://phpackages.com/packages/liaosp-think-swagger)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3372.3M3](/packages/darkaonline-swagger-lume)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[light/yii2-swagger

swagger intergation with yii2

154801.6k4](/packages/light-yii2-swagger)

PHPackages © 2026

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