PHPackages                             gungcahyadipp/auto-docs - 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. gungcahyadipp/auto-docs

ActiveLibrary[API Development](/categories/api)

gungcahyadipp/auto-docs
=======================

All-in-one API documentation for Laravel. Bundles Scramble and Scramble Pro.

v1.3.1(1mo ago)1163MITPHPPHP ^8.2

Since Feb 13Pushed 1mo agoCompare

[ Source](https://github.com/gungcahyadipp/auto-docs)[ Packagist](https://packagist.org/packages/gungcahyadipp/auto-docs)[ RSS](/packages/gungcahyadipp-auto-docs/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (12)Versions (9)Used By (0)

Auto-Docs
=========

[](#auto-docs)

All-in-one API documentation package for Laravel. Bundles [Scramble](https://scramble.dedoc.co) and Scramble Pro into a single package with automatic configuration, Bearer token auth, dark theme UI, and external docs support.

Features
--------

[](#features)

- Zero-config API documentation generation from your Laravel code
- Dark theme UI by default with Stoplight Elements
- Bearer JWT authentication auto-configured
- External markdown docs — separate endpoint descriptions from controller code
- Multi-version API support (V1, V2, etc.) with conflict detection
- Conditional extension loading for optional packages (Laravel Data, Query Builder, JSON:API, Laravel Actions)
- Single unified config file (`autodocs.php`)

Versions Bundled
----------------

[](#versions-bundled)

- `dedoc/scramble` v0.13.13
- `dedoc/scramble-pro` v0.8.7

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

[](#installation)

```
composer require gungcahyadipp/auto-docs
```

The package auto-discovers via Laravel's package discovery. No manual provider registration needed.

Configuration
-------------

[](#configuration)

Publish the config file:

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

Publish the API description markdown:

```
php artisan vendor:publish --tag=autodocs-description
```

Publish everything at once:

```
php artisan vendor:publish --tag=autodocs
```

Usage
-----

[](#usage)

Visit `/docs` to see the generated API documentation.

The JSON OpenAPI spec is available at `/docs/api.json`.

Config Overview
---------------

[](#config-overview)

All configuration lives in `config/autodocs.php`:

```
return [
    'api_path' => env('AUTODOCS_API_PATH', 'api'),
    'api_domain' => null,

    'info' => [
        'version' => env('API_VERSION', '1.0.0'),
        'description' => null, // Loaded from markdown file
    ],

    'description_file' => base_path('autodocs/description.md'),

    'ui' => [
        'title' => env('APP_NAME', 'API Documentation'),
        'theme' => 'dark', // 'light', 'dark', 'system'
        'layout' => 'responsive',
    ],

    'security' => [
        'type' => 'bearer',
        'format' => 'JWT',
    ],

    'docs_path' => base_path('autodocs'),
    'description_strategy' => 'file', // 'file', 'merge', 'fallback'
];
```

Security Scheme
---------------

[](#security-scheme)

Bearer JWT is enabled by default. All endpoints will show the lock icon in the docs UI.

To exclude an endpoint from authentication, use `@unauthenticated` in the PHPDoc:

```
/**
 * @unauthenticated
 */
public function login(Request $request) { ... }
```

To switch to API Key authentication:

```
// config/autodocs.php
'security' => [
    'type' => 'apiKey',
    'in' => 'header',
    'name' => 'X-API-Key',
],
```

To disable security entirely:

```
'security' => null,
```

External Docs (Separated Descriptions)
--------------------------------------

[](#external-docs-separated-descriptions)

Instead of writing long descriptions in your controller PHPDoc, you can create separate markdown files. **No changes needed in your controller** — the extension automatically matches doc files to endpoints based on controller name and method.

### Quick Start

[](#quick-start)

1. Generate the skeleton:

    ```
    php artisan autodocs:generate
    ```
2. Edit the generated `.md` files in `autodocs/`
3. Visit `/docs` — descriptions are loaded automatically

### How It Works (No Controller Changes Needed)

[](#how-it-works-no-controller-changes-needed)

Given this controller:

```
// app/Http/Controllers/Api/V1/UserController.php

namespace App\Http\Controllers\Api\V1;

class UserController extends Controller
{
    public function store(StoreUserRequest $request)
    {
        // Your logic here — NO PHPDoc needed for description
        return new UserResource(User::create($request->validated()));
    }
}
```

And this file:

```
autodocs/V1/UserController/store.md

```

The docs UI will automatically show the content from `store.md` as the endpoint description. You don't need to add any annotation, attribute, or PHPDoc to the controller.

### Combining with PHPDoc

[](#combining-with-phpdoc)

If you still want to use PHPDoc for some things (like `@unauthenticated` or `@tags`), that works fine:

```
/**
 * @unauthenticated
 */
public function login(LoginRequest $request)
{
    // Description comes from autodocs/AuthController/login.md
    // @unauthenticated still works from PHPDoc
}
```

The `description_strategy` config controls how external docs interact with any existing PHPDoc description.

### File Structure

[](#file-structure)

```
autodocs/
├── description.md          ← API homepage description
├── UserController/
│   ├── index.md            → GET /api/users
│   ├── store.md            → POST /api/users
│   └── show.md             → GET /api/users/{id}
├── V1/
│   └── UserController/
│       └── index.md        → For Api\V1\UserController@index
├── V2/
│   └── UserController/
│       └── index.md        → For Api\V2\UserController@index
└── OrderController/
    └── store.md

```

### Markdown Format

[](#markdown-format)

```
# Create a new user

Creates a new user account in the system. The user will receive
a verification email after successful registration.

## Business Rules

- Email must be unique
- Password must meet complexity requirements
- Users are created with 'pending' status by default
```

- First line (or `# heading`) becomes the **summary/title**
- Everything after the first blank line becomes the **description**

### Path Resolution

[](#path-resolution)

For a controller like `App\Http\Controllers\Api\V1\UserController@store`, the extension searches these paths in order:

1. `autodocs/Api/V1/UserController/store.md` (most specific)
2. `autodocs/V1/UserController/store.md`
3. `autodocs/UserController/store.md` (only if no V1/V2 conflict)
4. `autodocs/Api/V1/User/store.md` (without "Controller" suffix)
5. `autodocs/User/store.md`

### Multi-Version Safety

[](#multi-version-safety)

When both `V1/UserController/` and `V2/UserController/` exist in your docs folder, the short name fallback (`UserController/store.md`) is automatically disabled to prevent cross-version contamination.

### Description Strategy

[](#description-strategy)

Control how external docs interact with PHPDoc in your controllers:

StrategyBehavior`'file'`Markdown file **overrides** PHPDoc description (default)`'merge'`Markdown file is **appended** after PHPDoc description`'fallback'`Markdown file is used **only when** PHPDoc is emptyAPI Description (Homepage)
--------------------------

[](#api-description-homepage)

The API homepage description is loaded from a markdown file:

1. Default: bundled template from the package
2. After publish: `autodocs/description.md`

Edit this file to customize the description shown on the docs homepage.

Optional Package Support
------------------------

[](#optional-package-support)

Auto-Docs conditionally enables extensions for these packages when installed:

PackageWhat it enables`spatie/laravel-data`Data object schema generation`spatie/laravel-query-builder`Filter/sort/include parameter docs`timacdonald/json-api`JSON:API resource schema`lorisleiva/laravel-actions`Actions as controllers`spatie/laravel-json-api-paginate`JSON:API pagination paramsNo configuration needed — just install the package and docs are generated automatically.

Custom Extensions
-----------------

[](#custom-extensions)

Register your own Scramble extensions:

```
// config/autodocs.php
'extensions' => [
    App\Docs\MyCustomExtension::class,
],
```

Or programmatically in a service provider:

```
use Dedoc\Scramble\Scramble;

Scramble::registerExtension(MyTypeToSchemaExtension::class);
Scramble::registerExtension(MyOperationExtension::class);
```

Auto-Generate Docs Skeleton
---------------------------

[](#auto-generate-docs-skeleton)

Automatically scaffold markdown doc files for all your API endpoints:

```
php artisan autodocs:generate
```

This scans all registered API routes and creates `.md` files with a ready-to-fill template:

```
autodocs/
├── description.md
├── Api/V1/UserController/
│   ├── index.md
│   ├── store.md
│   ├── show.md
│   ├── update.md
│   └── destroy.md
└── Api/V1/OrderController/
    └── index.md

```

### Options

[](#options)

OptionDescription`--force`Overwrite existing doc files`--path=`Custom output path (default: from config `docs_path`)`--api-path=`Filter routes by API path prefix### Example

[](#example)

```
# Generate for all API routes
php artisan autodocs:generate

# Only generate for v2 routes
php artisan autodocs:generate --api-path=api/v2

# Regenerate all (overwrite existing)
php artisan autodocs:generate --force
```

Each generated file includes:

- Auto-generated title based on method name (e.g. "List all users", "Create a new order")
- HTTP method and URI as comment
- Placeholder sections for authentication, request body, and response

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance91

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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 ~14 days

Recently: every ~0 days

Total

8

Last Release

46d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.1.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30739832?v=4)[Gung Cahyadi](/maintainers/gungcahyadipp)[@gungcahyadipp](https://github.com/gungcahyadipp)

---

Top Contributors

[![gungcahyadipp](https://avatars.githubusercontent.com/u/30739832?v=4)](https://github.com/gungcahyadipp "gungcahyadipp (11 commits)")

---

Tags

laraveldocumentationopenapiscrambleauto-docs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gungcahyadipp-auto-docs/health.svg)

```
[![Health](https://phpackages.com/badges/gungcahyadipp-auto-docs/health.svg)](https://phpackages.com/packages/gungcahyadipp-auto-docs)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.9k3](/packages/defstudio-telegraph)[laravel/surveyor

Static analysis tool for Laravel applications.

86121.4k13](/packages/laravel-surveyor)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

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