laravel-static-docs maintained by yanikkumar
yanikkumar/laravel-static-docs
A lightweight, database-free static HTML documentation generator and CMS manager for Laravel.
Write documentation in Markdown from an admin UI, organize pages into sidebar sections with automatic #anchor sub-topics, customize the theme & project logo, and compile everything into fast static HTML files.
Features
- Zero Database: Stores Markdown sources (
markdown/*.md), sidebar manifest (manifest.json), theme settings (theme.json), and compiled static HTML (html/*.html) on disk. - Automatic
#anchorSub-Topics:##and###Markdown headings automatically receiveid="..."anchors and appear as nested#sub-topiclinks under the active page in the sidebar. - Public or Guarded Access: Works with or without authentication middleware (
viewer_middlewarecan be['web']for public docs or['web', 'auth']for private/internal docs). - Theme & Logo Customizer: Choose built-in presets, upload or link a project logo, customize primary/secondary/sidebar colors, and inject custom CSS.
- Contextual Help Button: Drop
<x-static-docs-help-button slug="your-page" />anywhere in Blade views to link users directly to the relevant documentation page.
Installation
Install directly via Composer (Packagist):
composer require yanikkumar/laravel-static-docs
Optional: Publish Config / Views & Seed Sample Docs
php artisan vendor:publish --tag=static-docs-config
php artisan vendor:publish --tag=static-docs-views
php artisan static-docs:seed
Configuration (config/static-docs.php)
- Public Docs (No Auth Guard):
'viewer_middleware' => ['web'], 'admin_middleware' => ['web', 'auth'], - Private Docs (Behind Auth / Role Guard):
'viewer_middleware' => ['web', 'auth'], 'admin_middleware' => ['web', 'auth', 'role:1'], - Integrate with Your Admin Layout (or leave
nullto use the package's built-in layout):'admin_layout' => 'layouts.app', 'admin_section' => 'content',
Usage
- Docs Viewer: Visit
/docs(or your configuredroute_prefix). - Docs Manager: Visit
/docs-manager(or your configuredadmin_route_prefix). - Seed Sample Docs:
php artisan static-docs:seed # or reset & seed fresh: php artisan static-docs:seed --fresh - Contextual Help Component:
<x-static-docs-help-button slug="advertisements" label="Know how this works" />
License
MIT