petebishwhip / laradocs
Maintain beautiful, version-controlled documentation alongside your Laravel codebase. Markdown in, a polished docs site out.
Requires
- php: ^8.2
- illuminate/contracts: ^11.14 || ^12.0 || ^13.0
- illuminate/support: ^11.14 || ^12.0 || ^13.0
- league/commonmark: ^2.4
- spatie/yaml-front-matter: ^2.0
Requires (Dev)
- larastan/larastan: ^2.9 || ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^9.0 || ^10.0 || ^11.0
- orchestra/workbench: ^9.0 || ^10.0 || ^11.0
- pestphp/pest: ^3.0 || ^4.0
- pestphp/pest-plugin-laravel: ^3.0 || ^4.0
- phpstan/phpstan: ^1.11 || ^2.0
- rector/rector: ^1.2 || ^2.0
This package is auto-updated.
Last update: 2026-06-04 00:15:44 UTC
README
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. - โ 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:
- Getting started
- Configuration
- Routing
- Metadata
- Caching
- CLI reference
- PHP API
- Variables ยท Macros ยท Rich content
- Customising the UI ยท Customising stubs
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.