Search by

fsrepos / laravel-docs-generator

fsrepos

Package info

github.com/fortestorerepos/laravel-docs

Homepage

pkg:composer/fsrepos/laravel-docs-generator

Fund package maintenance!

mackgame4

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-09-08 10:38 UTC

This package is not auto-updated.

Last update: 2026-09-22 14:00:13 UTC


README

Laravel Docs

Laravel Docs is a development-time documentation generator for Laravel applications. It orchestrates existing documentation tools, normalizes their structured output, and writes a standalone static HTML site.

The first supported sources are:

  • phpDocumentor for PHP code documentation
  • Scribe for API documentation
  • Laravel schema metadata for database documentation

Laravel Docs does not replace these tools or parse Laravel projects from scratch.

Installation

Install the package via Composer:

composer require --dev fsrepos/laravel-docs-generator

Publish the configuration file:

php artisan vendor:publish --tag=laravel-docs-config

Publish the static site Blade views when you want to customize the generated frontend:

php artisan vendor:publish --tag=laravel-docs-views

Scribe is installed with Laravel Docs. Laravel Docs forces Scribe's generated output and intermediate cache into storage/app/laravel-docs. For PHP code docs, Laravel Docs first looks for phpdoc, then downloads the official phpDocumentor PHAR automatically when needed.

Database docs use Laravel's configured database connection and schema metadata.

Configuration

The published config/laravel-docs.php file controls output paths, enabled sections, and tool locations.

return [
    'output_path' => storage_path('app/laravel-docs/generated'),

    'sections' => [
        'api' => true,
        'database' => true,
        'code' => true,
    ],

    'code' => [
        'executable' => 'phpdoc',
        'auto_download_phar' => true,
        'link_external_docs' => true,
        'phar_url' => 'https://phpdoc.org/phpDocumentor.phar',
        'phar_path' => storage_path('app/laravel-docs/bin/phpDocumentor.phar'),
        'cache_path' => storage_path('app/laravel-docs/cache/phpdocumentor'),
        'paths' => [
            app_path(),
        ],
    ],

    'api' => [
        'scribe_dir' => storage_path('app/laravel-docs/cache/scribe'),
        'generated_path' => storage_path('app/laravel-docs/raw/scribe'),
    ],

    'database' => [
        'connection' => null,
    ],
];

Set laravel-docs.database.connection to a named Laravel database connection when you do not want to use the default connection. Set laravel-docs.code.link_external_docs to false when generated code pages should avoid external framework documentation links.

Usage

Generate documentation:

php artisan docs:generate

Laravel Docs writes files under:

storage/app/laravel-docs/

The generated static site is available at:

storage/app/laravel-docs/generated/index.html

You can open that file directly in a browser without running Laravel. The generated sections are routed as static pages: api.html, database.html, and code.html.

When you already have raw structured outputs and only want to rebuild the normalized JSON and static site, run:

php artisan docs:generate --skip-tools

Output Layout

storage/app/laravel-docs/
|-- raw/
|   |-- phpdocumentor/
|   `-- scribe/
|-- cache/
|   |-- phpdocumentor/
|   `-- scribe/
|-- normalized/
|   |-- api.json
|   |-- database.json
|   `-- code.json
`-- generated/
    |-- index.html
    |-- api.html
    |-- database.html
    |-- code.html
    `-- assets/
        |-- index.css
        `-- index.js

The UI is a compact static HTML page with API, DB, and Code tabs in the header. Its source lives in package Blade views and assets under resources/views/static, so the generated frontend can be customized without editing PHP generator strings. The header also includes a Download PDF action that exports the currently opened section. The API page uses a Scribe-like request layout with color-coded HTTP methods, a Try it out panel, copyable curl examples, and a sidebar that can show endpoint groups from Scribe or regroup the same requests by HTTP method.

Nested Scribe folders are included using their full group path (for example, Integracoes / Compras). Postman collection imports preserve URL parameter examples, inherited authentication, request headers, and response status codes and headers.

Headers and body parameters display examples before trying a request. Click Try it out to edit their values; edits update the curl example and outgoing request. The companion Scribe OpenAPI file supplies body parameter types and required/optional metadata.

Base URL and Authorization inputs are saved in browser local storage for this documentation directory and restored across endpoints and reloads. Clear either input to clear its saved value.

The console's Example body: section displays the raw request body, formats JSON for readability, and updates as body inputs change.

The header search opens a command palette across API, DB, and Code documentation, including table columns and code members. Use api:compras, db:users, or code:User to limit results to a section. Results show their location and open by click or Enter; arrow keys change the selection, Escape closes the palette, and Ctrl/Cmd+K opens it. Search works offline in generated HTML. The database diagram places related tables across a pannable, zoomable canvas and routes connections around cards. Drag a table to rearrange it, drag empty space to pan, and use the mouse wheel to zoom. Table positions are saved in your browser for that schema; Reset clears saved positions and restores the original table layout, connections, zoom, and camera position.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to Laravel Docs! Please review our contributing guide to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Laravel Docs is open-sourced software licensed under the MIT license.