PHPackages                             wfgm5k2d/phplightdoc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wfgm5k2d/phplightdoc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wfgm5k2d/phplightdoc
====================

Creating auto-documentation

1.0.13(7mo ago)210MITPHPPHP &gt;=7.4

Since Apr 3Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/wfgm5k2d/php-light-doc)[ Packagist](https://packagist.org/packages/wfgm5k2d/phplightdoc)[ Docs](https://github.com/wfgm5k2d/php-light-doc)[ RSS](/packages/wfgm5k2d-phplightdoc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

Laravel API Documentation Generator
===================================

[](#laravel-api-documentation-generator)

[![Laravel](https://camo.githubusercontent.com/5a580364ff3bd338370177402c5c050ff81a1933927e1e475c920c90850b38a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/5a580364ff3bd338370177402c5c050ff81a1933927e1e475c920c90850b38a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)[![API Docs](https://camo.githubusercontent.com/46b203e5e6aeb23760eacccaba9e371a458315cb4be0f07c66c41d0dcc93bc03/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f63732d3130302532352532304175746f6d617465642d627269676874677265656e3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/46b203e5e6aeb23760eacccaba9e371a458315cb4be0f07c66c41d0dcc93bc03/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f63732d3130302532352532304175746f6d617465642d627269676874677265656e3f7374796c653d666f722d7468652d6261646765)

This package automatically analyzes Laravel controllers and routes, extracting information about groups, names, middleware, response codes, and generating user-friendly documentation in JSON format.

📦 Installation
--------------

[](#-installation)

```
composer require wfgm5k2d/php-light-doc
```

📦 Publish all files
-------------------

[](#-publish-all-files)

```
php artisan vendor:publish --provider='Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider'
```

Configure environment variables
-------------------------------

[](#configure-environment-variables)

```
# Your path to the documentation file
PATH_TO_FILE_DOCUMENTATION='/your_full_path_to_file/api_documentation.json'
# List folders to scan, separated by commas if there are many
PATH_TO_DIR_SCAN='app/Domain, app/Http/Controllers'
# Exclude folders from scanning, separated by commas if there are many
PATH_TO_DIR_EXCLUDE='app/Http/Controllers/Admin, CustomBackupController'
```

🚀 Usage
-------

[](#-usage)

After installation, a command to generate documentation will appear in Laravel:

```
php artisan doc:generate
```

The documentation will be saved in the file specified in `.env` and will be available in the browser at the `/doc` route.

📝 Annotations and attributes
----------------------------

[](#-annotations-and-attributes)

You can additionally annotate controllers and methods for a more accurate API description.

### Controller Grouping

[](#controller-grouping)

Groups help structure the documentation into thematic sections.

#### Simple grouping

[](#simple-grouping)

You can give a name to a controller group. All routes of this controller will fall into the specified group.

**Via comment:**

```
// group Users
final class UserController extends Controller
```

**Or attribute:**

```
#[DocGName('Users')]
final class UserController extends Controller
```

---

#### **🆕 Advanced grouping (nested groups)**

[](#-advanced-grouping-nested-groups)

You can also create top-level groups to combine multiple controllers. To do this, you need to pass a second parameter to the `DocGName` attribute — the name of the main group.

**Via attribute:**

```
// This controller will be placed in the "Users API" subgroup within the main "Users" group
#[DocGName('Users API', 'Users')]
final class UserController extends Controller {
    // ...
}

// This controller will be placed in the "Authentication" subgroup within the same main "Users" group
#[DocGName('Authentication', 'Users')]
final class AuthController extends Controller {
    // ...
}
```

This allows you to create a more complex and convenient documentation structure.

---

Route Description
-----------------

[](#route-description)

You can set a clear name for the route:

**Via comment:**

```
// name Create a compensation request
public function createApplication(Request $request): JsonResponse```
**Or attribute:**

```php
#[DocRName('Create a compensation request')]
public function createApplication(Request $request): JsonResponse
```

Middleware Requirements
-----------------------

[](#middleware-requirements)

If a method requires authorization or special headers, specify it explicitly.

**Via comment:**

```
// middleware-name Authentication required
// middleware-value Authorization: Bearer {token}
final class SecureController extends Controller
```

**Or attribute:**

```
#[DocMiddleware('Authentication required', 'Authorization: Bearer {token}')]
final class SecureController extends Controller
```

By default, the following set of middleware is checked: `auth`, `throttle`, `can`, `requires`.

Response Codes
--------------

[](#response-codes)

The package searches for response codes in these constructs:

```
return response()->json()
return new JsonResponse([])
return new JsonResponse([], Response::HTTP_...)
return new JsonResponse([], 200)
```

By default, the response code will be 200 if no others are specified.

You can manually specify the available response codes if they are not detected

**Via comment:**

```
// response-codes 200 404 500
public function getUserData(Request $request): JsonResponse```

**Or attribute:**

```php
#[DocResponseCodes()]
public function getUserData(Request $request): JsonResponse
```

🔄 Generating and viewing documentation
--------------------------------------

[](#-generating-and-viewing-documentation)

Run the generation command:

```
php artisan doc:generate
```

Open `/doc` in your browser to view.

How to develop the package locally?
-----------------------------------

[](#how-to-develop-the-package-locally)

- Deploy a Laravel project locally. The last package build was on Laravel 12

```
laravel new php-light-doc
```

- Inside the project, create a `packages` folder

```
cd php-light-doc
mkdir "packages"
```

- This is your packages directory. Add the `wfgm5k2d` namespace here

```
mkdir "wfgm5k2d"
```

- Clone the package code from the repository into it
- In the providers, connect the package provider

#### Laravel &lt;= 10v.

[](#laravel--10v)

- In the `config/app.php` file, add the package provider to the `providers` array

```
'providers' => [
    ...
    \Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider::class,
]
```

#### Laravel &gt;= 11v.

[](#laravel--11v)

- In the `bootstrap/providers.php` file, add the package provider to the array

```
return [
    ...
    \Wfgm5k2d\PhpLightDoc\Providers\PhpLightDocServiceProvider::class,
]
```

- In `composer.json`, connect the package in the autoload section

```
{
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Wfgm5k2d\\PhpLightDoc\\": "packages/wfgm5k2d/php-lite-doc/src",
            ...
        }
    }
}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance62

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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 ~13 days

Recently: every ~2 days

Total

14

Last Release

233d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09c496c49fa313e543bd84ca1d1dd492b5f9883d9a0c0b02d120cdeecddcddf8?d=identicon)[wfgm5k2d](/maintainers/wfgm5k2d)

---

Top Contributors

[![wfgm5k2d](https://avatars.githubusercontent.com/u/48546925?v=4)](https://github.com/wfgm5k2d "wfgm5k2d (10 commits)")[![nikita-stena](https://avatars.githubusercontent.com/u/229108648?v=4)](https://github.com/nikita-stena "nikita-stena (9 commits)")

---

Tags

laravelPhpLightDoc

### Embed Badge

![Health badge](/badges/wfgm5k2d-phplightdoc/health.svg)

```
[![Health](https://phpackages.com/badges/wfgm5k2d-phplightdoc/health.svg)](https://phpackages.com/packages/wfgm5k2d-phplightdoc)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[zidbih/laravel-deadlock

Make temporary Laravel workarounds expire and fail CI when ignored.

961.8k](/packages/zidbih-laravel-deadlock)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)

PHPackages © 2026

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