PHPackages                             gamesi/filament-menu-builder-compat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. gamesi/filament-menu-builder-compat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gamesi/filament-menu-builder-compat
===================================

Create and manage menus and menu items

1.0.0(1y ago)02MITPHPPHP ^8.1

Since Dec 9Pushed 1y agoCompare

[ Source](https://github.com/GameSiProjects/filament-menu-builder-compat)[ Packagist](https://packagist.org/packages/gamesi/filament-menu-builder-compat)[ Docs](https://github.com/datlechin/filament-menu-builder)[ GitHub Sponsors](https://github.com/datlechin)[ RSS](/packages/gamesi-filament-menu-builder-compat/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Filament Menu Builder
=====================

[](#filament-menu-builder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6ad423cb53074527898ea2bafa8c2d9168c6aead593f42ac3e0674974b815718/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461746c656368696e2f66696c616d656e742d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/datlechin/filament-menu-builder)[![Total Downloads](https://camo.githubusercontent.com/bfdd215b5e54648ec9a1514751abe23c07d7ccb31cb7d15931e08ffe2c1d8cba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461746c656368696e2f66696c616d656e742d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/datlechin/filament-menu-builder)

This [Filament](https://filamentphp.com) package allows you to create and manage menus in your Filament application.

[![Filament Menu Builder](https://github.com/datlechin/filament-menu-builder/raw/main/art/menu-builder.jpg)](https://github.com/datlechin/filament-menu-builder/raw/main/art/menu-builder.jpg)

Note

I created this for my personal project, so some features and extensibility are still lacking. Pull requests are welcome.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require datlechin/filament-menu-builder
```

You need to publish the migrations and run them:

```
php artisan vendor:publish --tag="filament-menu-builder-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-menu-builder-config"
```

Optionally, if you want to customize the views, you can publish them with:

```
php artisan vendor:publish --tag="filament-menu-builder-views"
```

This is the contents of the published config file:

```
return [
    'tables' => [
        'menus' => 'menus',
        'menu_items' => 'menu_items',
        'menu_locations' => 'menu_locations',
    ],
];
```

Add the plugin to `AdminPanelProvider`:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(FilamentMenuBuilderPlugin::make())
```

Usage
-----

[](#usage)

### Adding locations

[](#adding-locations)

Locations are the places where you can display menus in the frontend. You can add locations in the `AdminPanelProvider`:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addLocation('header', 'Header')
            ->addLocation('footer', 'Footer')
    )
```

The first argument is the key of the location, and the second argument is the title of the location.

Alternatively, you may add locations using an array:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addLocations([
                'header' => 'Header',
                'footer' => 'Footer',
            ])
    )
```

### Setting up Menu Panels

[](#setting-up-menu-panels)

Menu panels are the panels that contain the menu items which you can add to the menus.

#### Custom Link Menu Panel

[](#custom-link-menu-panel)

By default, the package provides a **Custom Link** menu panel that allows you to add custom links to the menus.

[![Custom Link Menu Panel](https://github.com/datlechin/filament-menu-builder/raw/main/art/custom-link.png)](https://github.com/datlechin/filament-menu-builder/raw/main/art/custom-link.png)

The panel can be disabled by using the following when configuring the plugin, should you not need this functionality.

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->showCustomLinkPanel(false)
    )
```

#### Custom Text Menu Panel

[](#custom-text-menu-panel)

This package provides a **Custom Text** menu panel that allows you to add custom text items to the menus.

It is identical to the **Custom Link** menu panel except for the fact that you only set a title without a URL or target. This can be useful to add headers to mega-style menus.

The panel is disabled by default to prevent visual clutter. To enable the Custom Text menu panel, you can use the following when configuring the plugin.

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->showCustomTextPanel()
    )
```

#### Static Menu Panel

[](#static-menu-panel)

The static menu panel allows you to add menu items manually.

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Datlechin\FilamentMenuBuilder\MenuPanel\StaticMenuPanel;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addMenuPanels([
                StaticMenuPanel::make()
                    ->add('Home', url('/'))
                    ->add('Blog', url('/blog')),
            ])
    )
```

Similarily to locations, you may also add static menu items using an array:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Datlechin\FilamentMenuBuilder\MenuPanel\StaticMenuPanel;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addMenuPanels([
                StaticMenuPanel::make()
                    ->addMany([
                        'Home' => url('/'),
                        'Blog' => url('/blog'),
                    ])
            ])
    )
```

[![Static Menu Panel](https://github.com/datlechin/filament-menu-builder/raw/main/art/static-menu.png)](https://github.com/datlechin/filament-menu-builder/raw/main/art/static-menu.png)

#### Model Menu Panel

[](#model-menu-panel)

The model menu panel allows you to add menu items from a model.

To create a model menu panel, your model must implement the `\Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable` interface and `\Datlechin\FilamentMenuBuilder\Concerns\HasMenuPanel` trait.

Then you must also implement the `getMenuPanelTitleColumn` and `getMenuPanelUrlUsing` methods. A complete example of this implementation is as follows:

```
use Datlechin\FilamentMenuBuilder\Concerns\HasMenuPanel;
use Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable;
use Illuminate\Database\Eloquent\Model;

class Category extends Model implements MenuPanelable
{
    use HasMenuPanel;

    public function getMenuPanelTitleColumn(): string
    {
        return 'name';
    }

    public function getMenuPanelUrlUsing(): callable
    {
        return fn (self $model) => route('categories.show', $model->slug);
    }
}
```

Then you can add the model menu panel to the plugin:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Datlechin\FilamentMenuBuilder\MenuPanel\ModelMenuPanel;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addMenuPanels([
                ModelMenuPanel::make()
                    ->model(\App\Models\Category::class),
            ])
    )
```

[![Model Menu Panel](https://github.com/datlechin/filament-menu-builder/raw/main/art/model-menu.png)](https://github.com/datlechin/filament-menu-builder/raw/main/art/model-menu.png)

#### Additional Menu Panel Options

[](#additional-menu-panel-options)

When registering a menu panel, multiple methods are available allowing you to configure the panel's behavior such as collapse state and pagination.

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Datlechin\FilamentMenuBuilder\MenuPanel\StaticMenuPanel;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addMenuPanels([
                StaticMenuPanel::make()
                    ->addMany([
                        ...
                    ])
                    ->description('Lorem ipsum...')
                    ->icon('heroicon-m-link')
                    ->collapsed(true)
                    ->collapsible(true)
                    ->paginate(perPage: 5, condition: true)
            ])
    )
```

### Custom Fields

[](#custom-fields)

In some cases, you may want to extend menu and menu items with custom fields. To do this, start by passing an array of form components to the `addMenuFields` and `addMenuItemFields` methods when registering the plugin:

```
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->addMenuFields([
                Toggle::make('is_logged_in'),
            ])
            ->addMenuItemFields([
                TextInput::make('classes'),
            ])
    )
```

Next, create a migration adding the additional columns to the appropriate tables:

```
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table(config('filament-menu-builder.tables.menus'), function (Blueprint $table) {
            $table->boolean('is_logged_in')->default(false);
        });

        Schema::table(config('filament-menu-builder.tables.menu_items'), function (Blueprint $table) {
            $table->string('classes')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table(config('filament-menu-builder.tables.menus'), function (Blueprint $table) {
            $table->dropColumn('is_logged_in');
        });

        Schema::table(config('filament-menu-builder.tables.menu_items'), function (Blueprint $table) {
            $table->dropColumn('classes');
        });
    }
}
```

Once done, simply run `php artisan migrate`.

### Customizing the Resource

[](#customizing-the-resource)

Out of the box, a default Menu Resource is registered with Filament when registering the plugin in the admin provider. This resource can be extended and overridden allowing for more fine-grained control.

Start by extending the `Datlechin\FilamentMenuBuilder\Resources\MenuResource` class in your application. Below is an example:

```
namespace App\Filament\Plugins\Resources;

use Datlechin\FilamentMenuBuilder\Resources\MenuResource as BaseMenuResource;

class MenuResource extends BaseMenuResource
{
    protected static ?string $navigationGroup = 'Navigation';

    public static function getNavigationBadge(): ?string
    {
        return number_format(static::getModel()::count());
    }
}
```

Now pass the custom resource to `usingResource` while registering the plugin with the panel:

```
use App\Filament\Plugins\Resources\MenuResource;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->usingResource(MenuResource::class)
    )
```

### Customizing the Models

[](#customizing-the-models)

The default models used by the plugin can be configured and overridden similarly to the plugin resource as seen above.

Simply extend the default models and then pass the classes when registering the plugin in the panel:

```
use App\Models\Menu;
use App\Models\MenuItem;
use App\Models\MenuLocation;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

$panel
    ...
    ->plugin(
        FilamentMenuBuilderPlugin::make()
            ->usingMenuModel(Menu::class)
            ->usingMenuItemModel(MenuItem::class)
            ->usingMenuLocationModel(MenuLocation::class)
    )
```

### Using Menus

[](#using-menus)

Getting the assigned menu for a registered location can be done using the `Menu` model. Below we will call the menu assigned to the `primary` location:

```
use Datlechin\FilamentMenuBuilder\Models\Menu;

$menu = Menu::location('primary');
```

Menu items can be iterated from the `menuItems` relationship:

```
@foreach ($menu->menuItems as $item)
    {{ $item->title }}
@endforeach
```

When a menu item is a parent, a collection of the child menu items will be available on the `children` property:

```
@foreach ($menu->menuItems as $item)
    {{ $item->title }}

    @if ($item->children)
        @foreach ($item->children as $child)
            {{ $child->title }}
        @endforeach
    @endif
@endforeach
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/datlechin/filament-menu-builder/raw/main/CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/datlechin/filament-menu-builder/raw/main/.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/datlechin/filament-menu-builder/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ngo Quoc Dat](https://github.com/datlechin)
- [Log1x](https://github.com/Log1x)
- [All Contributors](https://github.com/datlechin/filament-menu-builder/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/datlechin/filament-menu-builder/raw/main/LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

518d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83da60eda685e54d5a8fc6449eb119c8821716e736b0fa8495edb22d074cf342?d=identicon)[GameSiProjects](/maintainers/GameSiProjects)

---

Top Contributors

[![datlechin](https://avatars.githubusercontent.com/u/56961917?v=4)](https://github.com/datlechin "datlechin (94 commits)")[![Log1x](https://avatars.githubusercontent.com/u/5745907?v=4)](https://github.com/Log1x "Log1x (58 commits)")[![depfu[bot]](https://avatars.githubusercontent.com/in/715?v=4)](https://github.com/depfu[bot] "depfu[bot] (15 commits)")[![Senexis](https://avatars.githubusercontent.com/u/6360733?v=4)](https://github.com/Senexis "Senexis (8 commits)")[![bdsumon4u](https://avatars.githubusercontent.com/u/75123992?v=4)](https://github.com/bdsumon4u "bdsumon4u (2 commits)")[![GameSiProjects](https://avatars.githubusercontent.com/u/70065506?v=4)](https://github.com/GameSiProjects "GameSiProjects (2 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![StevyMarlino](https://avatars.githubusercontent.com/u/25743606?v=4)](https://github.com/StevyMarlino "StevyMarlino (1 commits)")

---

Tags

laraveldatlechinfilament-menu-builder

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gamesi-filament-menu-builder-compat/health.svg)

```
[![Health](https://phpackages.com/badges/gamesi-filament-menu-builder-compat/health.svg)](https://phpackages.com/packages/gamesi-filament-menu-builder-compat)
```

###  Alternatives

[datlechin/filament-menu-builder

Create and manage menus and menu items

13550.3k2](/packages/datlechin-filament-menu-builder)[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12247.8k](/packages/jibaymcs-filament-tour)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

9169.0k4](/packages/marcelweidum-filament-expiration-notice)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
