PHPackages                             svensp/laravel-swagger - 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. svensp/laravel-swagger

ActiveLibrary[API Development](/categories/api)

svensp/laravel-swagger
======================

generate openapi api-docs.json from laravel route definitions and annotated .yml file

0.4.1(8mo ago)0407↓100%MITPHPPHP &gt;=7.4

Since Mar 5Pushed 8mo ago1 watchersCompare

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

READMEChangelogDependencies (12)Versions (8)Used By (0)

laravel-swagger
===============

[](#laravel-swagger)

this package tries to assist in generating api-doc.yml files for your laravel based apis.

It does not try to generate the whole api-doc.yml for you and thus does not function as complete abstraction layer for the openapi specification. Instead think of it as `route:list` that makes sure your open-api.yml files have all routes present and notify you of routes present in the open-api.yml but not in your laravel routes.

- the controller in which a route resides decides the open-api.yml the route appears in via the @apidoc phpdoc entry
- multiple controllers can use the same open-api.yml

Install
-------

[](#install)

to install the package simply require it with composer:

```
composer require svensp/laravel-swagger

```

Use
---

[](#use)

Annotate the controllers which should appear in an open-api.yml with

```
/**
* Class AuthController
* @apidoc path/to/your/open-api.yml
*/
class AuthController {
...

```

and have them created with

```
./artin open-api:generate

```

It is however recommended to publish the config file and use an alias:

```
./artisan vendor:publish --provider=LaravelSwagger\LaravelSwaggerProvider

```

The default settings map `@` to `app_path()`, personally I map the name `default` to `resource_path('/open-api.yml')`

```
/**
* Class AuthController
* @apidoc @/resources/open-api.yml
* OR
* @apidoc default
*
*/
class AuthController {
...

```

### Tags

[](#tags)

If you use the same open-api.yml for multiple controllers then you probably want to have the same tags set for all routes of the same controller. You an use the `@apitags` phpdoc directive to have this done automatically for you:

```
/**
* Class AuthController
* @apidoc default
* @apitags auth
*
*/
class AuthController {
...

/**
* Class NewsController
* @apidoc default
* @apitags news
*
*/
class NewsController {
...

```

the list of tags is parsed as comma separated list.

Roadmap
-------

[](#roadmap)

- (maybe) add parameters defined in FormRequests used by a controller function

Use outside of Laravel
----------------------

[](#use-outside-of-laravel)

While I have not split the package in its laravel and open-api components it is possible to use it outside of Laravel. Simply instantiate the LaravelSwagger\\OpenApi\\Updater and pass an array of `DefinedRoute`s to its `update` function. Creating DefinedRoutes from your framework of choice is up to you, as is passing

- templates usually loaded from the config
- aliases usually loaded from the config
- callbacks - set in the laravel command to echo having foud a controller without @apidoc directive or routes in the open-api.yml which are no longer present in your DefinedRoutes

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance60

Regular maintenance activity

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~272 days

Recently: every ~408 days

Total

7

Last Release

256d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f1ab6ff16fc96d20efd363563c961db68587721536c6559d692f461588a1246?d=identicon)[svensp](/maintainers/svensp)

---

Top Contributors

[![vafSpeckmaier](https://avatars.githubusercontent.com/u/233957372?v=4)](https://github.com/vafSpeckmaier "vafSpeckmaier (5 commits)")[![svensp](https://avatars.githubusercontent.com/u/7204121?v=4)](https://github.com/svensp "svensp (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/svensp-laravel-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/svensp-laravel-swagger/health.svg)](https://phpackages.com/packages/svensp-laravel-swagger)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/roster

Detect packages &amp; approaches in use within a Laravel project

15410.4M7](/packages/laravel-roster)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
