pxlrbt/laravel-docs
Composer 安装命令:
composer require pxlrbt/laravel-docs
包简介
Render markdown documentation inside Laravel with a modern VitePress-inspired layout.
README 文档
README
Render markdown documentation inside Laravel.
Requirements
- PHP 8.2+
- Laravel 11 or 12
Installation
composer require pxlrbt/laravel-docs
Publish the config and assets:
php artisan vendor:publish --tag=docs-config php artisan vendor:publish --tag=docs-assets
Usage
Place markdown files in the configured root directory (default: docs/). Each file needs YAML frontmatter:
--- title: "Getting Started" description: "An introduction to the app" group: "Basics" order: 0 --- Your markdown content here.
Pages are accessible at /{url_prefix}/{slug}, e.g. /docs/getting-started.
Configuration
The config file (config/docs.php) supports multiple doc instances as a keyed array:
return [ 'default' => [ 'root' => env('DOCS_ROOT', 'docs'), // Markdown files directory 'url_prefix' => env('DOCS_URL_PREFIX', 'docs'),// URL path prefix 'layout' => null, // Blade layout component to wrap content 'requires_auth' => false, // Require authentication 'auth_middleware' => ['auth'], // Middleware when auth is required 'can_access_docs' => null, // Closure for fine-grained access control 'has_navigation' => true, // Show sidebar navigation 'has_sidebar' => true, // Show table of contents 'has_pagination' => true, // Show prev/next page links ], ];
Multiple Instances
Define additional instances to serve separate doc sections with different configs:
return [ 'default' => [ 'root' => 'docs', 'url_prefix' => 'docs', ], 'api' => [ 'root' => 'docs/api', 'url_prefix' => 'api-docs', 'requires_auth' => true, ], ];
Access Control
Use the can_access_docs callback for fine-grained access control:
'can_access_docs' => function ($user) { return $user?->isAdmin(); },
Custom Layout
Wrap the docs in your app's layout by setting the layout option to a Blade component name:
'layout' => 'layouts.app',
When no layout is set, docs render as a standalone page with their own styles.
Features
- GitHub-flavored markdown (tables, strikethrough, etc.)
- Auto-generated table of contents from h2/h3 headings
- Heading permalink anchors
- Sidebar navigation grouped by frontmatter
group - Prev/next page pagination
- Responsive design (mobile, tablet, desktop)
- Sidebar caching for performance
- Directory traversal protection
License
MIT
pxlrbt/laravel-docs 适用场景与选型建议
pxlrbt/laravel-docs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 872 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「documentation」 「markdown」 「docs」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pxlrbt/laravel-docs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pxlrbt/laravel-docs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pxlrbt/laravel-docs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.
Adds more BBCode
Api documentation generator for Laravel 5
Replacement for Swagger. It is built for Laravel
统计信息
- 总下载量: 872
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-09