// DOCS KNOWLEDGE BASE 2.x
Outdated

You are reading the documentation for 2.x. The current version is 3.x.

View 3.x docs →

Installation

You can install the package via composer:

composer require guava/filament-knowledge-base:"^2.0"

Next, install @tailwindcss/typography if you don't have it already, since we use prose to style the markdown output:

npm install -D @tailwindcss/typography

Then publish the package assets:

php artisan filament:assets

Setup

If you don't have a separate panel yet for your knowledge base, please create one using the built in filament command:

php artisan make:filament-panel

For example, you might create a panel named knowledge-base.

Next, add the KnowledgeBasePlugin plugin to your knowledge base panel service provider:

use Guava\FilamentKnowledgeBase\Plugins\KnowledgeBasePlugin;

$panel->plugin(KnowledgeBasePlugin::make());

Similarly, add the KnowledgeBaseCompanionPlugin plugin to your regular panel service provider:

use Guava\FilamentKnowledgeBase\Plugins\KnowledgeBaseCompanionPlugin;

$panel->plugin(KnowledgeBaseCompanionPlugin::make()
    ->knowledgeBasePanelId('knowledge-base') // Put your knowledge base panel ID here
);
NOTEA custom filament theme is required for the plugin to work!

If you don't have one, please refer to the filament documentation on how to create a custom theme.

And lastly, add the following to your custom filament theme to correctly build the CSS and use the required tailwind plugins:

@plugin "@tailwindcss/typography";
@source '../../../../vendor/guava/filament-knowledge-base/src/**/*';
@source '../../../../vendor/guava/filament-knowledge-base/resources/views/**/*';
IMPORTANTIt is important that both your filament knowledge base panel and your regular panel(s) use a custom theme with these source paths. It's up to you if you want to use the same theme for all panels or different themes for each.

Creating documentation pages

By default, all your documentation files should live in the docs/<panel-id> directory in the root of your project. The structure is covered in detail on the markdown files page.

To create documentation pages, simply run the docs:make command and follow the instructions:

php artisan docs:make

This will create a basic empty documentation file. To edit it, simply open it in your favorite editor.

An example of a documentation page:

---
title: Introduction
---
# Introduction
This is my first documentation page

If you visit your regular filament panel, you should now see a button at the bottom of your sidebar that will lead you to your knowledge base panel with your first documentation page!

guava/filament-knowledge-base 161K installs · 210 stars
// COOKIES

A few cookies keep the site working; others remember preferences or count visits. You choose what runs.

Cookie policy