PHPackages                             lengbin/yii-gii-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. [API Development](/categories/api)
4. /
5. lengbin/yii-gii-swagger

ActiveLibrary[API Development](/categories/api)

lengbin/yii-gii-swagger
=======================

This generator generates swagger annotation

1.0.8(6y ago)4151↓100%[1 issues](https://github.com/ice-leng/yii-gii-swagger/issues)MITPHPPHP &gt;=5.3.0

Since Jun 14Pushed 6y agoCompare

[ Source](https://github.com/ice-leng/yii-gii-swagger)[ Packagist](https://packagist.org/packages/lengbin/yii-gii-swagger)[ RSS](/packages/lengbin-yii-gii-swagger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 generate swagger annotation
================================

[](#yii2-generate-swagger-annotation)

This extension provides a Web-based code generator, called Gii, for [Yii framework 2.0](http://www.yiiframework.com) applications. You can use Gii to quickly generate `swagger 2.0(openapi 2.0)` annotation.

For license information check the [LICENSE](LICENSE.md)-file.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require lengbin/yii-gii-swagger

```

or add

```
"lengbin/yii-gii-swagger": *

```

to the require-dev section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply modify your application configuration at your `application\config\main_local.php` as follows:

```
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class'      => 'yii\gii\Module',
        'generators' => [
            'swagger' => [
                'class'      => 'lengbin\gii\swagger\Generator', //class
                'parameters' => [],                              //set default request parameters
                'responses'  => [                               //set default respons parameters
                    'responseStatus'      => [200, 'default'],
                    'responseDescription' => ['success', '请求失败， http status 强行转为200, 通过code判断'],
                    'ref'                 => ['SuccessDefault', 'ErrorDefault'],
                ],
            ],
            //...
        ],
    ];
    //...
```

You can then access Gii through the following URL:

```
http://localhost/path/to/index.php?r=gii

```

or if you have enabled pretty URLs, you may use the following URL:

```
http://localhost/path/to/index.php/gii

```

extension
---------

[](#extension)

You can use swagger doc extension [yii-swagger](https://github.com/ice-leng/yii-swagger).

Screenshots
-----------

[](#screenshots)

Entire page [![giiant-0 2-screen-1](./image/1.png)](./image/1.png)Custom parameter [![giiant-0 2-screen-2](./image/2.png)](./image/2.png)generate `swagger 2.0(openapi 2.0)` annotation [![giiant-0 2-screen-3](./image/3.jpg)](./image/3.jpg)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

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

Total

9

Last Release

2449d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9342ed631e7bf15897f2e15d0a853800b84cb315e601eb3a58f2cc8938b5d011?d=identicon)[ice.leng](/maintainers/ice.leng)

---

Top Contributors

[![ice-leng](https://avatars.githubusercontent.com/u/7506787?v=4)](https://github.com/ice-leng "ice-leng (12 commits)")

### Embed Badge

![Health badge](/badges/lengbin-yii-gii-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/lengbin-yii-gii-swagger/health.svg)](https://phpackages.com/packages/lengbin-yii-gii-swagger)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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