使用 Laradocs 在 Laravel 应用中实现版本控制文档

发布日期 经过

使用 Laradocs 镜像在 Laravel 应用中实现版本控制文档

Laradocs is a Laravel package that serves a documentation site from markdown files kept inside your codebase. You write the docs next to the code they describe, commit them together, and Laradocs renders them at /docs with navigation, search-friendly metadata, and a responsive UI.

  • 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.
  • 和更多

Folder Structure Becomes Navigation

Laradocs builds its sidebar from your directory layout. Nested folders turn into sections, and an _index.md file acts as a section's landing page. Routing follows the filenames by default, but you can override a path with a slug field in front-matter when you want a URL that differs from the file location.

Scaffold a new page with the generator command:

php 工匠 make:doc guide/getting-started --title= "Getting Started" --order=1

Front-Matter Metadata

Each page carries metadata in YAML front-matter that controls how it appears in navigation and search:

---
标题 : 入门
描述 : Install and configure the app.
命令 : 1
团体 : 基础知识
---

Supported fields include title , description , order , hidden , group , badge , redirect , tags , 和 slug . Markdown is processed through CommonMark with GitHub-flavored markdown, tables, and footnotes, plus callout blocks using the familiar GitHub syntax:

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

Variables and Macros for Reuse

To avoid repeating values across pages, Laradocs lets you register shared variables and reusable macro blocks from a service provider. Variables interpolate into markdown with {{ value }} syntax, and macros render with an @docs() block:

使用 PeteBishwhip\Laradocs\Facades\Laradocs ;
Laradocs :: variables fn () => [ '版本' => '1.0.0' ]);
Laradocs :: 分享 'app_name' , 配置 ‘应用程序名称’ ));
Laradocs :: 'tweet' , fn 大批 $args) => "<a href= \” ... \” >@{ $args ['user']}</a>" (英文):

SEO, Caching, and Output

Rendered pages get automatic meta tags, Open Graph and Twitter card data, and JSON-LD, along with a generated sitemap at {prefix}/sitemap.xml . Laradocs caches rendered pages and invalidates the cache when source files change. You can also pre-render every page ahead of time or clear the cache manually:

php 工匠 laradocs:cache
php 工匠 laradocs:clear

The package requires PHP 8.2+ and supports Laravel 11, 12, and 13. You can learn more on the Laradocs website and view the source on GitHub

保罗·雷德蒙德照片

Laravel News 特约撰稿人。全栈 Web 开发人员兼作家。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

访问 Laravel Cloud
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
绝不妥协标志

绝不妥协

来自 No Compromises 播客的两位经验丰富的开发者 Joel 和 Aaron 现在可以为您的 Laravel 项目提供服务。⬧ 固定费用 9500 美元/月。⬧ 无冗长的销售流程。⬧ 无需签订合同。⬧ 100% 退款保证。

绝不妥协
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
Laracon US 2026 公布完整扬声器阵容图片

Laracon US 2026 公布完整演讲嘉宾阵容

阅读文章
PHP 2026 年发展状况调查现已开放(图片)

《2026年菲律宾比索发展状况调查》现已开放

阅读文章
Laravel 13.15.0 中的类型化翻译访问器

Laravel 13.15.0 中的类型化翻译访问器

阅读文章
刷新 Laravel 数据库而不删除所有表图片

无需删除所有表即可刷新 Laravel 数据库

阅读文章
Laravel 13.14 中的 JSON Schema 反序列化图片

Laravel 13.14 中的 JSON Schema 反序列化

阅读文章
使用 Sqids 图片从数字生成简短、URL 安全的 ID

使用 Sqids 从数字生成简短、URL 安全的 ID

阅读文章