---
title: Create Laravel Swagger API – Jaeves Codelab
description: Swagger provides us tools to create documentation for our apis and shares their definitions with teams, developers or consumers. Here we will create larave
---

[Start Coding with Codelab | Jaeves AI](https://jaeves.com/codelab)

# [Create Laravel Swagger API – Jaeves Codelab](https://jaeves.com/codelab/create-laravel-swagger-api)

 Written by [Admin](https://jaeves.com/codelab/author/admin) | Oct 2, 2023, 10:51:02 PM

Swagger provides us tools to create documentation for our apis and shares their definitions with teams, developers or consumers. Here we will create laravel swagger API documentation.

Install the laravel swagger package using the below commands

```
composer require "darkaonline/l5-swagger"
```

If facing version issue then use this command

```
composer require darkaonline/l5-swagger:*
```

Now open config/app.php and add this line in providers section.

**L5Swagger\\L5SwaggerServiceProvider::class,**

Now publish L5-Swagger’s config and view files with this commands

```
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
```

To generate the swagger api documentation run

```
php artisan l5-swagger:generate
```

We can also set L5\_SWAGGER\_GENERATE\_ALWAYS = true in .env file to autogenerate the api documentation.

Now we can access our api documentation with this url https://mywebsite.com/api/documentation.

Click here to create[Laravel Swagger API](https://jaeves.com/codelab/create-swagger-configuration-in-laravel/)

Read [laravel swagger documentation here](https://github.com/DarkaOnLine/L5-Swagger).

[View full post](https://jaeves.com/codelab/create-laravel-swagger-api)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Admin"
  },
  "dateModified" : "2023-12-20T12:22:11.384Z",
  "datePublished" : "2023-10-02T22:51:02Z",
  "headline" : "Create Laravel Swagger API",
  "image" : {
    "@type" : "ImageObject",
    "height" : 60,
    "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
    "width" : 60
  },
  "mainEntityOfPage" : "https://jaeves.com/codelab/create-laravel-swagger-api",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60.0,
      "url" : "https://139767802.fs1.hubspotusercontent-eu1.net/hubfs/139767802/logos/jaeves-logo-230907.png",
      "width" : 185.625
    },
    "name" : "Codelab"
  }
}
```