petebishwhip/laradocs

Maintain beautiful, version-controlled documentation alongside your Laravel codebase. Markdown in, a polished docs site out.

Maintainers

Package info

github.com/PeteBishwhip/laradocs

Homepage

pkg:composer/petebishwhip/laradocs

Statistics

Installs: 303

Dependents: 0

Suggesters: 0

Stars: 15

Open Issues: 21

v0.2.0.1 2026-06-06 13:37 UTC

This package is auto-updated.

Last update: 2026-06-09 21:10:12 UTC


README

tests quality Latest Version License

Maintain beautiful, version-controlled documentation inside your Laravel codebase. Write markdown, commit it next to the code it describes, and Laradocs serves a polished docs site at /docs (or wherever you like).

composer require petebishwhip/laradocs
php artisan laradocs:install

Then open /docs.

Features

  • πŸ“ Multi-level file structure β€” nested folders become nested navigation.
  • πŸ”— Filename or metadata routing β€” slug: front-matter overrides paths.
  • πŸ“ Markdown β†’ HTML powered by CommonMark (GFM, tables, footnotes, …).
  • 🏷️ Rich per-file metadata β€” title, description, order, hidden, group, badge, redirect, tags, and more.
  • 🎨 Polished default UI β€” responsive, dark-mode, sidebar, breadcrumbs, on-page table of contents, prev/next β€” all publishable and overridable.
  • ⚑ Smart caching β€” rendered HTML cached and auto-invalidated on file change.
  • 🧩 Variables & macros β€” interpolate {{ values }} and reuse @docs() blocks, with a service-provider API to register your own.
  • πŸ–ΌοΈ Rich content β€” callouts (> [!NOTE]), syntax-highlighted code with a copy button, lazy images with captions, and local/YouTube/Vimeo video embeds.
  • πŸ”Ž Automatic SEO β€” <title>, meta description, Open Graph & Twitter cards, canonical URLs and JSON-LD for every page, with per-page front-matter overrides.
  • πŸ—ΊοΈ Sitemap β€” an auto-generated sitemap.xml at {prefix}/sitemap.xml, cached and invalidated alongside the rest of the docs cache.
  • βœ… Fully tested β€” Pest + Testbench, 100% coverage gate, PHPStan max, Pint.

Quick start

Create a page:

php artisan make:doc guide/getting-started --title="Getting Started" --order=1
---
title: Getting Started
description: Install and configure the app.
order: 1
group: Basics
---

# Getting Started

> [!TIP]
> Folders become sidebar sections; `_index.md` is a section's landing page.

Configuration

Everything is configurable in config/laradocs.php and via environment variables β€” route prefix/domain, docs path, routing strategy, theme, caching and more. See the Configuration docs.

LARADOCS_ROUTE_PREFIX=docs
LARADOCS_THEME=auto
LARADOCS_ENABLED=true

The Laradocs facade

use Laradocs\Facades\Laradocs;

Laradocs::variables(fn () => ['version' => '1.0.0']);
Laradocs::share('app_name', config('app.name'));
Laradocs::macro('tweet', fn (array $args) => "<a href=\"...\">@{$args['user']}</a>");

Artisan commands

Command Description
laradocs:install Publish config and scaffold a starter page
make:doc {name} Scaffold a new markdown page with front-matter
laradocs:cache Pre-render and cache every page
laradocs:clear Clear the documentation cache

Publishing

php artisan vendor:publish --tag=laradocs-config
php artisan vendor:publish --tag=laradocs-views
php artisan vendor:publish --tag=laradocs-assets

Testing

composer test

Documentation

The full docs live at laradocs.dev/docs β€” and are themselves built with Laradocs. Highlights:

The source for those pages lives in docs/; browse there or serve a local copy with composer serve.

Contributing & Security

See CONTRIBUTING.md and SECURITY.md.

License

The MIT License (MIT). See LICENSE.md.