Courses

How to Build Laravel 11 API From Scratch

Generating API Documentation with OpenAPI Swagger

Summary of this lesson:
- Alternative API documentation using Swagger/OpenAPI
- Configuring L5-Swagger package
- Adding documentation annotations in controllers

In this lesson, we will check another tool for generating API documentation called Laravel Swagger using the DarkaOnLine/L5-Swagger package.

Swagger is an open standard for APIs, not specifically for Laravel or PHP. It is general for all APIs. Now, swagger is called OpenAPI, but you can find it in both names on the internet.

This package works similarly to Scribe by adding docblocks and running an artisan command to generate documentation.


You can install Swagger via Composer.

composer require "darkaonline/l5-swagger"

And publish config with views if needed.

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

You can specify global configuration in the...

The full lesson is only for Premium Members.
Want to access all 23 lessons of this course? (58 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord