PHPackages                             kadonix/laravel-swagger-routebook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kadonix/laravel-swagger-routebook

ActiveLibrary[API Development](/categories/api)

kadonix/laravel-swagger-routebook
=================================

A tiny route-first Swagger documentation package for Laravel.

v1.0.1(1mo ago)0126↑185.7%[4 PRs](https://github.com/kadonix/laravel-swagger-routebook/pulls)MITPHPPHP ^8.1CI passing

Since May 7Pushed 4w agoCompare

[ Source](https://github.com/kadonix/laravel-swagger-routebook)[ Packagist](https://packagist.org/packages/kadonix/laravel-swagger-routebook)[ RSS](/packages/kadonix-laravel-swagger-routebook/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (7)Used By (0)

Laravel Swagger Routebook
=========================

[](#laravel-swagger-routebook)

Laravel Swagger Routebook is a small Laravel package for generating Swagger API documentation from your existing routes and controllers.

It keeps documentation close to your code with simple `@` annotations or PHP attributes, then exposes a Swagger UI page, a JSON spec, Postman export, documentation coverage, and a docs audit command.

Features
--------

[](#features)

- Swagger UI at `/docs`
- JSON spec at `/docs/spec.json`
- Simple annotations: `@Endpoint`, `@Parameter`, `@Body`, `@Returns`, `@Response`, `@Example`
- PHP attributes for teams that prefer typed metadata
- Route method and path inferred from Laravel routes
- Request schema generation from `FormRequest` rules
- Response schema generation from DTO classes
- `components.schemas` generation for Swagger UI's Schemas section
- Bearer auth detection from `auth` / `auth:*` middleware
- Grouped specs with `group="admin"` and `?group=admin`
- Postman export from the UI or Artisan
- Documentation audit with `routebook:check`
- Documentation coverage with `routebook:coverage`

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

Installation
------------

[](#installation)

```
composer require kadonix/laravel-swagger-routebook
```

If you want the constraint to be written with three version digits in your project:

```
composer require "kadonix/laravel-swagger-routebook:^1.0.0"
```

Publish the config file if you want to customize Routebook:

```
php artisan vendor:publish --tag=routebook-config
```

Then open:

```
/docs

```

The generated JSON spec is available at:

```
/docs/spec.json

```

Quick Start
-----------

[](#quick-start)

Create a normal Laravel controller:

```
