Install Swagger in Laravel

1 step: Create Laravel 5 Project

2 step: Install Swagger Package

Or you can install specific verion

For use of @SWG annotation we are going to install the following package

Publish config

Your composer.json should be like the following

if any error come then use zircote/swagger-php 2.0 version

3 Step: Edit .env

Add the following codes in your .env file

4 Step: Create A controller that wants to have Swagger Annotations

5 Step: Add Annotation in Controller.php (located in \app\Http\Controllers\Controller.php)

Check Swagger Annotations here to learn more about annotations

6: Access our APIs

To access our API navigate to your project with  following url

http://localhost/l5swagger/api/documentation


if any error come try to use

For authorization
for controller side

and update in l5-swagger.php located in \config folder

Congratuation! You learned to document API.

3 comments to Install Swagger in Laravel

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">