2017 © Pedro Peláez
 

library yii2-swagger

swagger intergation with yii2

image

light/yii2-swagger

swagger intergation with yii2

  • Friday, March 30, 2018
  • by light
  • Repository
  • 8 Watchers
  • 91 Stars
  • 41,064 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 30 Forks
  • 0 Open issues
  • 16 Versions
  • 22 % Grown

The README.md

, (*1)

Yii2 Swagger Extension


version Download Issues, (*2)

swagger-php integration with yii2., (*3)

Integration swagger-ui with swagger-php., (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

php composer.phar require --prefer-dist light/yii2-swagger "~3.0" --dev

or add, (*7)

"light/yii2-swagger": "~3.0"

to the require section of your composer.json file., (*8)

Usage

Configure two action as below:, (*9)

public function actions()
{
    return [
        //The document preview addesss:http://api.yourhost.com/site/doc
        'doc' => [
            'class' => 'light\swagger\SwaggerAction',
            'restUrl' => \yii\helpers\Url::to(['/site/api'], true),
        ],
        //The resultUrl action.
        'api' => [
            'class' => 'light\swagger\SwaggerApiAction',
            //The scan directories, you should use real path there.
            'scanDir' => [
                Yii::getAlias('@api/modules/v1/swagger'),
                Yii::getAlias('@api/modules/v1/controllers'),
                Yii::getAlias('@api/modules/v1/models'),
                Yii::getAlias('@api/models'),
            ],
            //The security key
            'api_key' => 'balbalbal',
        ],
    ];
}

For security, you can config api key for protection., (*10)

Caching

public function actions()
{
    return [
        // ...
        'api' => [
            // ...
            'cache' => 'cache',
            'cacheKey' => 'api-swagger-cache', // default is 'api-swagger-cache'
        ],
    ];
}

Clear cache

Access clear cache url YOUR_API_URL?clear-cache or YOUR_API_URL?api_key=YOUR_API_KEY&clear-cache, (*11)

Example: curl 'http://localhost/v1/swagger/api?clear-cache', (*12)

you will see: Succeed clear swagger api cache., (*13)

Finally

If there also some confused, you can refer the Demo., (*14)

License

MIT, (*15)

The Versions

30/03 2018

dev-master

9999999-dev

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

30/03 2018

2.0.0-alpha

2.0.0.0-alpha

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

07/02 2018

1.0.x-dev

1.0.9999999.9999999-dev

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

07/02 2018

1.0.7

1.0.7.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

09/11 2017

1.0.6

1.0.6.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

18/04 2017

1.0.5

1.0.5.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

03/03 2017

1.0.4

1.0.4.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

02/03 2017

1.0.3

1.0.3.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

by lichunqiang

extension yii2 swagger restful document

18/07 2016

1.0.2

1.0.2.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

19/04 2016

1.0.1

1.0.1.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

10/01 2016

1.0.0

1.0.0.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

10/12 2015

0.2.3

0.2.3.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

08/12 2015

0.2.2

0.2.2.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

07/12 2015

0.2.1

0.2.1.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

07/12 2015

0.2.0

0.2.0.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document

07/12 2015

0.1.0

0.1.0.0

swagger intergation with yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by lichunqiang

extension yii2 swagger restful document