New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

pxlrbt/laravel-docs

Render markdown documentation inside Laravel with a modern VitePress-inspired layout.
2,356 4
Install
composer require pxlrbt/laravel-docs
Latest Version:v1.3.0
PHP:^8.2
Laravel:11 · 12 · 13
License:MIT
Last Updated:Oct 30, 2026
Links: GitHub  ·  Packagist
Maintainer: pxlrbt

Laravel Docs

Render markdown documentation inside Laravel.

Requirements

  • PHP 8.2+
  • Laravel 11, 12, or 13

Installation

composer require pxlrbt/laravel-docs

Publish the config and assets:

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

Usage

Place markdown files in the configured root directory (default: docs/). Each file needs YAML frontmatter:

---
title: "Getting Started"
description: "An introduction to the app"
group: "Basics"
order: 0
---

Your markdown content here.

Pages are accessible at /{url_prefix}/{slug}, e.g. /docs/getting-started.

Configuration

The config file (config/docs.php) supports multiple doc instances as a keyed array:

return [
    'default' => [
        'root' => env('DOCS_ROOT', 'docs'),           // Markdown files directory
        'url_prefix' => env('DOCS_URL_PREFIX', 'docs'),// URL path prefix
        'layout' => null,                              // Blade layout component to wrap content
        'requires_auth' => false,                      // Require authentication
        'auth_middleware' => ['auth'],                  // Middleware when auth is required
        'can_access_docs' => null,                     // Closure for fine-grained access control
        'has_navigation' => true,                      // Show sidebar navigation
        'has_sidebar' => true,                         // Show table of contents
        'has_pagination' => true,                      // Show prev/next page links
    ],
];

Multiple Instances

Define additional instances to serve separate doc sections with different configs:

return [
    'default' => [
        'root' => 'docs',
        'url_prefix' => 'docs',
    ],
    'api' => [
        'root' => 'docs/api',
        'url_prefix' => 'api-docs',
        'requires_auth' => true,
    ],
];

Access Control

Use the can_access_docs callback for fine-grained access control:

'can_access_docs' => function ($user) {
    return $user?->isAdmin();
},

Custom Layout

Wrap the docs in your app's layout by setting the layout option to a Blade component name:

'layout' => 'layouts.app',

When no layout is set, docs render as a standalone page with their own styles.

Features

  • GitHub-flavored markdown (tables, strikethrough, etc.)
  • Auto-generated table of contents from h2/h3 headings
  • Heading permalink anchors
  • Lightbox for images and videos (prev/next, arrow keys, counter)
  • Image captions from the image title: ![Alt](https://raw.githubusercontent.com/pxlrbt/laravel-docs/HEAD/image.png "Caption"). For videos, wrap them in <figure> with a <figcaption>. Captions also show in the lightbox
  • Accordions via <details>/<summary> (leave a blank line after <summary> so markdown inside is rendered)
  • Mermaid diagrams
  • Sidebar navigation grouped by frontmatter group
  • Prev/next page pagination
  • Responsive design (mobile, tablet, desktop)
  • Sidebar caching for performance
  • Directory traversal protection

License

MIT

Related Packages

petebishwhip/laradocs

Maintain beautiful, version-controlled documentation alongside your Laravel code...

85,295 138
stechstudio/laravel-docent

Docent — give your Laravel app a guide. Beautiful, contextual, permission-aware...

1,596 0
xoshbin/pertuk

A powerful Laravel documentation package with multi-language support, markdown p...

1,041 1
jeffersongoncalves/filament-documentation

A Filament plugin to add markdown-based documentation to your admin panel.

4,286 9
dniccum/nova-documentation

A Laravel Nova tool that allows you to add markdown-based documentation to your...

127,274 37

Version History

Version Released PHP Laravel License
v1.3.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v1.2.1 ^8.2 ^11.0|^12.0|^13.0 MIT
v1.2.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v1.1.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v1.0.0 ^8.2 ^11.0|^12.0 MIT