Looking to hire Laravel developers? Try LaraJobs

laravel-docs-generator maintained by fsrepos

Last update
2026/09/08 16:30 (dev-main)
License
Downloads
7

Comments
comments powered by Disqus

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.

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.