PHP code example of eightynine / filament-docs

1. Go to this page and download the library: Download eightynine/filament-docs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eightynine / filament-docs example snippets


return [
    'default_docs_path' => resource_path('docs'),
    'search' => [
        'debounce_ms' => 300,
    ],
    'ui' => [
        'sidebar_width' => 'lg:w-80',
        'default_navigation_group' => 'Documentation',
    ],
];



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',
        ],
    ],
];

class CachedDocsPage extends DocsPage
{
    protected function getCachedContent(string $filename): string
    {
        return Cache::remember(
            "docs.content.{$filename}",
            3600,
            fn() => $this->loadAndProcessMarkdown($filename)
        );
    }
}
bash
php artisan vendor:publish --tag="filament-docs-config"
bash
php artisan vendor:publish --tag="filament-docs-views"
bash
php artisan vendor:publish --tag="filament-docs-assets"