Laradocs: Version-Controlled Docs in Your Laravel App | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Version-Controlled Documentation Inside Your Laravel App with Laradocs

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

 Version-Controlled Documentation Inside Your Laravel App with Laradocs
=======================================================================

 Integrate version-controlled documentation directly into your Laravel application with Laradocs. This package renders Markdown files into a searchable, navigable documentation site within your codebase.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 11 Jun 2026 · Updated 12 Jun 2026 · 3 min read

ShareCopy linkCopied

 ![Version-Controlled Documentation Inside Your Laravel App with Laradocs](https://cdn.msaied.com/126/95c32a6d3da997b2fff70c90d9df52d7.png) 

  On this page +1. [Key Features](#key-features)
2. [Structuring Your Docs](#structuring-your-docs)
3. [Front-Matter for Control](#front-matter-for-control)
4. [Reusability with Variables and Macros](#reusability-with-variables-and-macros)
5. [SEO, Caching, and Output Management](#seo-caching-and-output-management)

 Keeping your documentation in sync with your codebase is crucial for maintainability and developer experience. The Laradocs package offers a streamlined solution by allowing you to manage your documentation directly within your Laravel application's files.

Laradocs transforms Markdown files, stored alongside your code, into a fully functional documentation website accessible at a designated route, typically `/docs`. This approach ensures that your documentation evolves with your application, benefiting from version control and simplifying the development workflow.

Key Features
------------

Laradocs boasts a range of features designed to enhance documentation management:

- **Hierarchical Navigation:** Multi-level folder structures are automatically translated into nested navigation menus, making it easy for users to browse through documentation sections.
- **Flexible Routing:** Content routing can be based on filenames or overridden using front-matter metadata, providing control over URL structures.
- **Markdown Processing:** Leverages CommonMark for rendering Markdown, supporting GitHub-Flavored Markdown, tables, and footnotes.
- **Rich Metadata:** Each documentation page can include extensive front-matter metadata such as title, description, order, group, badges, redirects, tags, and slugs.
- **Polished UI:** Offers a responsive user interface with features like dark mode, a sidebar, breadcrumbs, an on-page table of contents, and previous/next navigation. The UI is publishable and customizable.
- **Efficient Caching:** Implements smart caching for rendered HTML, with automatic invalidation triggered by file changes.

Structuring Your Docs
---------------------

The directory structure of your documentation files directly influences the sidebar navigation. Nested folders create distinct sections, and an `_index.md` file serves as the landing page for each section. For instance, you can scaffold a new documentation page using the Artisan command:

```bash
php artisan make:doc guide/getting-started --title="Getting Started" --order=1

```

Front-Matter for Control
------------------------

YAML front-matter within your Markdown files allows for granular control over how each page is presented and organized. Fields like `title`, `description`, `order`, `group`, `hidden`, `badge`, `redirect`, `tags`, and `slug` can be defined:

```yaml
---
title: Getting Started
description: Install and configure the app.
order: 1
group: Basics
---

```

Laradocs also supports callout blocks using familiar GitHub syntax for enhanced readability:

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

```

Reusability with Variables and Macros
-------------------------------------

To promote consistency and reduce repetition, Laradocs enables the definition of shared variables and reusable macro blocks within a service provider. Variables can be interpolated using `{{ value }}` syntax, while macros are invoked via `@docs()` blocks.

```php
use PeteBishwhip\Laradocs\Facades\Laradocs;

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

```

SEO, Caching, and Output Management
-----------------------------------

Laradocs automatically generates essential SEO elements, including meta tags, Open Graph and Twitter card data, and JSON-LD. A sitemap is also generated at `{prefix}/sitemap.xml`. The package intelligently caches rendered pages and invalidates them upon detecting changes in source files. Manual cache management is available through Artisan commands:

```bash
php artisan laradocs:cache
php artisan laradocs:clear

```

This package requires PHP 8.2+ and is compatible with Laravel 11, 12, and 13. For more details, visit the [Laradocs website](https://laradocs.dev/) or explore the source code on [GitHub](https://github.com/petebishwhip/laradocs).

[Read the original article](https://laravel-news.com/version-controlled-documentation-inside-your-laravel-app-with-laradocs).

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [Documentation](https://www.msaied.com/public/articles?search=Documentation)
- [PHP](https://www.msaied.com/public/articles?search=PHP)
- [Package](https://www.msaied.com/public/articles?search=Package)
- [Developer Tools](https://www.msaied.com/public/articles?search=Developer%20Tools)

 Frequently asked questions 
---------------------------

  How does Laradocs manage documentation versions?Laradocs integrates documentation directly into your codebase. By committing your Markdown documentation files alongside your code, they automatically benefit from your version control system (e.g., Git).

   Can I customize the appearance and routing of my Laradocs site?Yes, Laradocs offers a polished default UI that is publishable and overridable. Routing can be controlled via filenames or by using a 'slug' field in the front-matter metadata for custom URLs.

   How does Laradocs handle content reuse?Laradocs allows you to define shared variables and reusable macro blocks from a service provider. Variables can be interpolated into Markdown using `{{ value }}` syntax, and macros can be rendered using an `@docs()` block.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://www.msaied.com/public#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleAI Agents and the Future of Payments: Visa Integrates with ChatGPT](https://www.msaied.com/public/articles/ai-agents-and-the-future-of-payments-visa-integrates-with-chatgpt) [Next articleClaude Code v2.1.173 Release: A Minor Update for Developers](https://www.msaied.com/public/articles/claude-code-v21173-release-a-minor-update-for-developers)  

   On this page
-------------

1. [Key Features](#key-features)
2. [Structuring Your Docs](#structuring-your-docs)
3. [Front-Matter for Control](#front-matter-for-control)
4. [Reusability with Variables and Macros](#reusability-with-variables-and-macros)
5. [SEO, Caching, and Output Management](#seo-caching-and-output-management)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
