| Install | |
|---|---|
composer require eightynine/filament-docs |
|
| Latest Version: | 3.0.1 |
| PHP: | ^8.2 |
A Filament plugin for creating elegant documentation pages within your admin panel.
composer require eightynine/filament-docs
Publish configuration (optional):
php artisan vendor:publish --tag="filament-docs-config"
Create documentation directory:
mkdir -p resources/docs
php artisan make:filament-docs-page UserManual \
--navigation-group="Documentation" \
--navigation-icon="heroicon-o-book-open"
resources/docs/:# Getting Started
Welcome to the documentation!
The configuration file config/filament-docs.php allows customization:
return [
'default_docs_path' => resource_path('docs'),
'search' => [
'debounce_ms' => 300,
],
'ui' => [
'sidebar_width' => 'lg:w-80',
'default_navigation_group' => 'Documentation',
],
];
<?php
namespace App\Filament\Pages;
use EightyNine\FilamentDocs\Pages\DocsPage;
class UserManual extends DocsPage
{
protected static ?string $navigationIcon = 'heroicon-o-book-open';
protected static ?string $navigationGroup = 'Documentation';
protected static ?string $title = 'User Manual';
protected function getDocsPath(): string
{
return resource_path('user-manual');
}
protected function getSectionOrder(string $filename): int
{
return match($filename) {
'introduction' => 1,
'installation' => 2,
'usage' => 3,
default => 99,
};
}
}
// config/filament-docs.php
return [
'localization' => [
'supported_locales' => ['en', 'es', 'fr'],
'locale_paths' => [
'en' => 'docs/en',
'es' => 'docs/es',
'fr' => 'docs/fr',
],
],
];
Directory structure:
resources/docs/
├── en/
│ ├── getting-started.md
│ └── user-guide.md
├── es/
│ ├── getting-started.md
│ └── user-guide.md
└── fr/
├── getting-started.md
└── user-guide.md
# Basic page
php artisan make:filament-docs-page MyDocs
# With options
php artisan make:filament-docs-page ApiDocs \
--navigation-group="Developer" \
--navigation-icon="heroicon-o-code-bracket" \
--title="API Documentation" \
--slug="api-docs"
# Basic markdown file
php artisan make:filament-docs-markdown "Getting Started"
# With template
php artisan make:filament-docs-markdown "API Guide" --template=api
Available templates: basic, guide, api, troubleshooting, feature
Publish views for customization:
php artisan vendor:publish --tag="filament-docs-views"
Publish assets:
php artisan vendor:publish --tag="filament-docs-assets"
Add custom CSS:
.docs-container {
@apply max-w-7xl mx-auto;
}
.docs-sidebar {
@apply w-64 bg-white dark:bg-gray-900;
}
Enable caching for large documentation:
class CachedDocsPage extends DocsPage
{
protected function getCachedContent(string $filename): string
{
return Cache::remember(
"docs.content.{$filename}",
3600,
fn() => $this->loadAndProcessMarkdown($filename)
);
}
}
MIT License. See LICENSE.md for details.