PHPackages                             suzunone/l-auto-comment-for-php-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. suzunone/l-auto-comment-for-php-swagger

ActiveLibrary[API Development](/categories/api)

suzunone/l-auto-comment-for-php-swagger
=======================================

Automatically generate PHP Swagger comments from Laravel's Controller, Model, and form requests.

v0.0.11(4y ago)24.7kMITPHP

Since Feb 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/suzunone/l-auto-comment-for-php-swagger)[ Packagist](https://packagist.org/packages/suzunone/l-auto-comment-for-php-swagger)[ RSS](/packages/suzunone-l-auto-comment-for-php-swagger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (7)Used By (0)

Auto-generate SwaggerPHP comments from Laravel.
===============================================

[](#auto-generate-swaggerphp-comments-from-laravel)

Description
-----------

[](#description)

Auto-generate [Swagger-PHP](https://github.com/zircote/swagger-php) comments from models. Automatically generate [Swagger-PHP](https://github.com/zircote/swagger-php) comments using routing, form requests, and small annotations.

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

[](#installation)

```
composer require --dev suzunone/l-auto-comment-for-php-swagger
```

```
php artisan vendor:publish --provider="AutoCommentForPHPSwagger\LAutoCommentForPHPSwaggerServiceProvider" --tag=config
```

Usage
-----

[](#usage)

- `openapi:info-comment`
    - Create OA\\Info file
- `openapi:security-comment`
    - Create Security Setting file
- `openapi:create-model-to-schema`
    - Create [Swagger-PHP](https://github.com/zircote/swagger-php) schema file for models
- `openapi:file-to-annotation`
    - Create a comment definition from yaml or json
- `openapi:swagger-commen`
    - Automatically generate comments for [Swagger-PHP](https://github.com/zircote/swagger-php)

openapi annotation
------------------

[](#openapi-annotation)

Small annotations can be used instead of the very large [Swagger-PHP](https://github.com/zircote/swagger-php) format comments.

By writing in each method of Controller, [Swagger-PHP](https://github.com/zircote/swagger-php) style annotations are automatically generated from FormRequest and routing.

### FormRequest

[](#formrequest)

- `@property {TYPE} {VARIABLE NAME} {DESCRIPTION}`
- `@property-read {TYPE} {VARIABLE NAME} {DESCRIPTION}`

    Describes the parameters to be received in the request, the same as property in PHP Doc
- `@openapi-in {REQUEST IN} {VARIABLE NAME}`Specify the parameter location for the in field. If it is not specified, in="query" will be given.
- `@openapi-content {MIME} {FORMAT} {DESCRIPTION}`When using `request()->getContent()`, you can specify the contents of content. You can specify more than one, but only one description will be used.

### Controller

[](#controller)

- `@openapi`

    Describes if you want to include the `openapi:swagger-commen` target.
- `@openapi-tags`

    Describe the API tag.

    Can be multiple.

    If omitted, it will be automatically generated from the controller name, etc.
- `@openapi-response {HTTP STATUS} {RESPONSE SCHEMA} {DESCRIPTION}`

    You can describe the response of the API.

    Specify a pre-prepared schemas.

    schemas can be nested.

    Multiple entries can be made by changing the HTTP STATUS
- `@openapi-response-type {HTTP STATUS} {RESPONSE TYPE} {CONTENT TYPE}`

    The response type can be specified. You can choose from json xml media-type, and if you choose media-type, you can specify the content type. If there is more than one response type, multiple responses can be listed. If omitted, json will be used.
- `@openapi-ignore-session-cookie`
- `@openapi-session-cookie`

    Toggle whether to use session cookies.
- `@openapi-ignore-csrf-header`
- `@openapi-csrf-header`

    Toggle whether to use CSRF headers.
- `@openapi-security {securityScheme} {SCOPES(comma-separated)}`
- `@openapi-security {Security setting json}`

    Security settings to use

### A very simple example

[](#a-very-simple-example)

```
    /**
     * Here is the description of the API
     *
     * @openapi
     * @openapi-tags TAG-A
     * @openapi-tags TAG-B
     * @openapi-response 200 #/components/schemas/ExampleModel Success
     * @openapi-response 400 #/components/schemas/Error Bad Request
     * @openapi-response 403 #/components/schemas/Error Forbidden
     * @openapi-response 404 #/components/schemas/Error Not Found
     * @openapi-response 405 #/components/schemas/Error Invalid Input
     */
```

```
/**
 * @OA\Get(
 *   tags={"TAG-A", "TAG-B"},
 *   operationId="exampleIndex",
 *   path="/api/example",
 *   description="Here is the description of the API",
 *
 *   @OA\Response(
 *     response="200",
 *     description="Success",
 *     @OA\JsonContent(ref="#/components/schemas/ExampleModel")
 *   ),
 *   @OA\Response(
 *     response="400",
 *     description="Bad Request",
 *     @OA\JsonContent(ref="#/components/schemas/CommonError")
 *   ),
 *   @OA\Response(
 *     response="403",
 *     description="Forbidden",
 *     @OA\JsonContent(ref="#/components/schemas/CommonError")
 *   ),
 *   @OA\Response(
 *     response="404",
 *     description="Not Found",
 *     @OA\JsonContent(ref="#/components/schemas/CommonError")
 *   ),
 *   @OA\Response(
 *     response="405",
 *     description="Invalid Input",
 *     @OA\JsonContent(ref="#/components/schemas/CommonError")
 *   ),
 * )
*/
```

Nest Response Usage
-------------------

[](#nest-response-usage)

### Single Nest

[](#single-nest)

```
@openapi-response 200 #/components/schemas/ExampleModel&foo_model=#/components/schemas/FooModel&bar_mode=#/components/schemas/BarModel

```

### DeepNest

[](#deepnest)

```
@openapi-response 200 #/components/schemas/ExampleModel&foo_model[#/components/schemas/FooModel]&foo_model[bar_mode]=#/components/schemas/BarModel

```

Schema pattern of auto-generated Model
======================================

[](#schema-pattern-of-auto-generated-model)

Create{ModelName}
-----------------

[](#createmodelname)

Excluding columns with auto-increment. Except for references to other models.

Create{ModelName}WithRelation
-----------------------------

[](#createmodelnamewithrelation)

Excluding columns with auto-increment. Include references to other models.

{ModelName}
-----------

[](#modelname)

Include auto-incrementing columns. Except for references to other models.

{ModelName}WithRelation
-----------------------

[](#modelnamewithrelation)

Include auto-incrementing columns. Include references to other models.

{ModelName}Many
---------------

[](#modelnamemany)

Array of models. Except for references to other models.

{ModelName}WithRelationMany
---------------------------

[](#modelnamewithrelationmany)

Array of models. Include references to other models.

{ModelName}Paginate
-------------------

[](#modelnamepaginate)

Pagination of models. Except for references to other models.

{ModelName}WithRelationPaginate
-------------------------------

[](#modelnamewithrelationpaginate)

Pagination of models. Include references to other models.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

6

Last Release

1547d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/630015fa1a1a301f4fdebfc315ac1e2b6ad90ae681972e0d067c6887a7ed292d?d=identicon)[suzunone](/maintainers/suzunone)

---

Top Contributors

[![suzunone](https://avatars.githubusercontent.com/u/7632752?v=4)](https://github.com/suzunone "suzunone (79 commits)")

### Embed Badge

![Health badge](/badges/suzunone-l-auto-comment-for-php-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/suzunone-l-auto-comment-for-php-swagger/health.svg)](https://phpackages.com/packages/suzunone-l-auto-comment-for-php-swagger)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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