Laradocs: Version-Controlled Docs in Your Laravel App | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Version-Controlled Documentation Inside Your Laravel App with Laradocs        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)

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

 [  Laravel ](https://msaied.com/articles?category=laravel) [  Composer Pacakge ](https://msaied.com/articles?category=composer-pacakge)  #Laravel   #Documentation   #PHP   #Package   #Developer Tools  

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

     11 Jun 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   Key Features  ](#key-features)
2. [  02   Structuring Your Docs  ](#structuring-your-docs)
3. [  03   Front-Matter for Control  ](#front-matter-for-control)
4. [  04   Reusability with Variables and Macros  ](#reusability-with-variables-and-macros)
5. [  05   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).

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fversion-controlled-documentation-inside-your-laravel-app-with-laradocs&text=Version-Controlled+Documentation+Inside+Your+Laravel+App+with+Laradocs) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fversion-controlled-documentation-inside-your-laravel-app-with-laradocs) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  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). 

      Q02  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. 

      Q03  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. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Filament v3.3.54 Release Notes](https://cdn.msaied.com/127/9d69c31b365d86d4b5fd8377bc18afa2.png) Filament Laravel PHP 

### Filament v3.3.54 Release Notes

Discover the latest updates in Filament v3.3.54. This release focuses on bug fixes and minor improvements for...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 12 Jun 2026     2 min read  

  Read    

 ](https://msaied.com/articles/filament-v3354-release-notes) [ ![Filament v3.3.53 Release Notes](https://cdn.msaied.com/125/1ae0eeb0cf66afeb0bce8dc48b6c5121.png) Filament Laravel PHP 

### Filament v3.3.53 Release Notes

Explore the latest updates in Filament v3.3.53. This release focuses on bug fixes and minor improvements for t...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 12 Jun 2026     2 min read  

  Read    

 ](https://msaied.com/articles/filament-v3353-release-notes) [ ![Laracon US 2026 Speaker Lineup Revealed: A Deep Dive for Laravel Developers](https://cdn.msaied.com/123/31e2b8395c716f628ff8fa78a80df619.png) Laracon US Laravel Conference PHP 

### Laracon US 2026 Speaker Lineup Revealed: A Deep Dive for Laravel Developers

Laracon US 2026 has unveiled its full speaker lineup, featuring key Laravel core team members, prominent commu...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 11 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laracon-us-2026-speaker-lineup-revealed-a-deep-dive-for-laravel-developers) 

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

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
