phattarachai/laravel-ai-docs
Laravel AI Docs generates AI-friendly documentation for your Laravel application, exposing clean markdown and llms.txt endpoints so assistants and LLM tools can understand your app's routes, models, and features. Simple to install and configure.
The package turns a folder of Markdown files into structured, AI-consumable documentation (an llms.txt-style index plus per-page raw Markdown endpoints).
composer require phattarachai/laravel-ai-docs
php artisan vendor:publish --tag="ai-docs-config"
Then create your docs root (typically docs/ or resources/docs/) and add a root index.md. Hit the configured route (check config/ai-docs.php for the prefix and the index route name) and you should get the generated index back.
Where to look first:
docs/ directory convention — front matter keys (title, order, group) drive both navigation and the index output.First use case: expose your product or internal runbook docs to an AI assistant. Point it at the index endpoint, let it discover pages, then have it fetch individual pages as raw Markdown. That is the whole value proposition — no scraping, no HTML-to-text loss.
Start with a three-folder structure so you exercise grouping and nesting on day one rather than retrofitting it later:
docs/
├── index.md
├── getting-started/
│ ├── index.md
│ ├── installation.md
│ └── configuration.md
└── api/
├── index.md
└── authentication.md
index.md group front matter (new in v1.5.0)This is the headline change and it removes the main structural wart from earlier versions. Each folder's index.md can now declare its display label:
---
group: Getting Started
order: 1
---
The practical win: the folder name stays a clean slug (getting-started) while the label stays human-readable (Getting Started). Before this, you either lived with Getting-Started in the nav or invented a mapping table in config.
Patterns that fall out of it:
misc/ to other/ no longer forces a nav copy change — but it does change URLs, so treat slugs as a public API once an agent has cached them.group with order in the folder's index.md so sections sort deliberately instead of alphabetically.index.md has no group should fall back to the folder name or page title — verify this in your own tree, because a partially-labelled docs folder is the most likely source of a confusing nav.index.md is a descriptor, not just a page. Treat it as the folder's cover sheet: label, order, and optionally the overview prose that renders as the section landing page.Keep page front matter minimal and consistent — title and order are the workhorses. Anything you add becomes a schema you have to maintain across hundreds of files, so resist custom keys unless you actually render them.
The typical integration is two-step discovery:
Feed step 1 into the system prompt or tool schema; expose step 2 as a tool call. Because output is Markdown rather than HTML, you skip a stripping/preprocessing step entirely.
Put auth middleware on the whole route group via config if the docs describe internal APIs, schemas, or incident runbooks. Do this before the first deploy — it is far easier than retrofitting after something is indexed.
Generate/cache the index in your deploy pipeline rather than per-request, and warm it as a build step. Doc content changes on deploy, not at runtime, so a cache keyed to the deploy is correct and cheap.
--- block silently kills parsing and the file renders as a page with no title/group.group: API: Reference fails or truncates. Use group: "API: Reference".group labels merge. If two folders both declare group: Guides, they will almost certainly collapse into one nav group. Intentional when you want it, baffling when you don't — prefix labels (Guides: Billing, Guides: Shipping) if merging isn't the goal.local) after every content edit; wire a watcher or a composer/artisan script if you iterate on docs frequently.index.md double duty. If the same file both labels the folder and renders as the section landing page, expect it to appear in listings too. Confirm whether it's excluded from the page list and adjust your expectations for "N pages" counts./{any}) defined earlier in the stack will swallow your docs prefix. Check route order with php artisan route:list when you get 404s on one file but not others.storage/. Docs mounted as a read-only volume will otherwise fail with a permission error that looks like a missing-file error.setup.md → installation.md breaks every external link and every agent that cached the index. Add redirects or accept the churn knowingly.index.md itself as a lightweight per-section config surface. Prefer these over forking the package — the front matter schema is the intended customisation seam and v1.5.0 widened it.How can I help you explore Laravel packages today?