phplaravelswaggerlumen

I am looking for a solution to generate a swagger automatically


Stack:

I heard about the method to write the definitions directly in PhpDocs to generate a swagger.

Can you explain me this solution (the one to write in PhpDocs) or, propose me a better solution please (like some package for example)?

EDIT: Solved by @Aranya Sen:

composer require "darkaonline/swagger-lume" -W

$app->withFacades(); add this line before Register Container Bindings section:
    
$app->configure('swagger-lume'); add this line in Register Service Providers section:
    
$app->register(\SwaggerLume\ServiceProvider::class);

Write annotations Generate swagger: php artisan swagger-lume:generate


Solution

  • You can use the package darkaonline/l5-swagger. With this, you can add the API documentation in phpdoc, and generate a Swagger documentation using an artisan command php artisan l5-swagger:generate provided by this package.

    Here are some examples to get a taste of it, and here's the documentation