benjamincrozat/lumen-swagger

This package is abandoned and no longer maintained. The author suggests using the lumen-swagger package instead.

Generate API documentation with swag.

1.0.3 2018-05-17 07:52 UTC

This package is not auto-updated.

Last update: 2018-09-05 09:34:55 UTC


README

Build Status Latest Stable Version Total Downloads License

Lumen Swagger

Generate API documentation with swag.

Installation

Lumen

composer require benjamincrozat/lumen-swagger

Add the following line in your bootstrap/app.php:

$app->register(BC\LumenSwagger\ServiceProvider::class);

Laravel

If you wish to run this package on Laravel, you can easily do it. Just install it via Composer and you're done, thanks to its automatic package discovery.

composer require benjamincrozat/lumen-swagger

Usage

Once you annotated your models and controllers (see documentation here), using the command is pretty straightforward:

php artisan swagger

Generated at "/path/to/project/swagger.json"

You can also specify a custom path:

php artisan swagger --path whatever/documentation.json

Generated at "/path/to/project/whatever/documentation.json"

And even change the scanned location:

php artisan swagger --scan whatever

Generated at "/path/to/project/swagger.json"

Tip

In my own opinion, I think annotations are great for this use case, but messy. Writing API specs in your code isn't the cleanest thing to do. Your files quickly get unecessarly bloated. In Lumen Boilerplate, I opted for a single file config/swagger.php. Just run the following command to scan the config directory:

php artisan swagger --scan config

License

WTFPL