eightynine / filament-docs
Elegant documentation system for your Filament application with search, navigation, and markdown support
3.0.1
2025-06-24 06:22 UTC
Requires
- php: ^8.2
- barryvdh/laravel-dompdf: ^3.0
- filament/filament: ^3.0
- illuminate/contracts: ^10.0|^11.0|^12.0
- league/commonmark: ^2.4
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- nunomaduro/collision: ^7.9|^8.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
- pestphp/pest-plugin-arch: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
README
A Filament plugin for creating elegant documentation pages within your admin panel.
Features
- Markdown Support: Full CommonMark compatibility with syntax highlighting
- Real-time Search: Instant search with context-aware results
- Responsive Design: Mobile-first with dark mode support
- Multi-language: Built-in internationalization support
- Theme Integration: Seamlessly integrates with Filament themes
- Artisan Commands: CLI tools for generating pages and content
Requirements
- PHP 8.1+
- Laravel 10.0+
- Filament 3.0+
Installation
composer require eightynine/filament-docs
Publish configuration (optional):
php artisan vendor:publish --tag="filament-docs-config"
Create documentation directory:
mkdir -p resources/docs
Quick Start
- Create a documentation page:
php artisan make:filament-docs-page UserManual \ --navigation-group="Documentation" \ --navigation-icon="heroicon-o-book-open"
- Add markdown files to
resources/docs/
:
# Getting Started
Welcome to the documentation!
- Access your documentation in the Filament admin panel.
Configuration
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', ], ];
Advanced Usage
Custom Documentation Page
<?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, }; } }
Multi-language Support
// 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
Commands
Create Documentation Page
# 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"
Create Markdown Content
# 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
Customization
Custom Views
Publish views for customization:
php artisan vendor:publish --tag="filament-docs-views"
Custom Styling
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; }
Performance Optimization
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) ); } }
License
MIT License. See LICENSE.md for details.