PHPackages                             novius/laravel-filament-menu - 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. novius/laravel-filament-menu

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

novius/laravel-filament-menu
============================

A Filament package to manage menus in your application.

1.0.0(2mo ago)3131↓50%2AGPL-3.0-or-laterPHPPHP ^8.2CI passing

Since Jan 22Pushed 2mo agoCompare

[ Source](https://github.com/novius/laravel-filament-menu)[ Packagist](https://packagist.org/packages/novius/laravel-filament-menu)[ RSS](/packages/novius-laravel-filament-menu/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (17)Versions (3)Used By (0)

Laravel Filament Menu Manager
=============================

[](#laravel-filament-menu-manager)

[![Novius CI](https://github.com/novius/laravel-filament-menu/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/novius/laravel-filament-menu/actions/workflows/main.yml)[![Packagist Release](https://camo.githubusercontent.com/571f6e1018cf2ce2a5ab53ecdbebd95505ca3541da75a86b19b65e9578bacdd7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f766975732f6c61726176656c2d66696c616d656e742d6d656e752e7376673f6d61784167653d31383030267374796c653d666c61742d737175617265)](https://packagist.org/packages/novius/laravel-filament-menu)[![License: AGPL v3](https://camo.githubusercontent.com/c61341f63648cdd5aba4f7a073b513106a63778c27b15f96c56157642bc943b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4147504c25323076332d626c75652e737667)](http://www.gnu.org/licenses/agpl-3.0)

Introduction
------------

[](#introduction)

This [Laravel Filament](https://filamentphp.com/) package allows you to manage menus in your Laravel Filament admin panel.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Laravel Filament &gt;= 4
- Laravel Framework &gt;= 11.0

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

[](#installation)

```
composer require novius/laravel-filament-menu
```

Publish the Filament assets:

```
php artisan filament:assets
```

Then run the migrations:

```
php artisan migrate
```

In your `AdminFilamentPanelProvider`, add the `MenuManagerPlugin`:

```
use Novius\LaravelFilamentMenu\Filament\MenuManagerPlugin;

class AdminFilamentPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugins([
                MenuManagerPlugin::make(),
            ])
            // ...
            ;
    }
}
```

### Configuration

[](#configuration)

Several options are available for you to override.

```
php artisan vendor:publish --provider="Novius\LaravelFilamentMenu\LaravelFilamentMenuServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Blade directive

[](#blade-directive)

You have two ways to manage the styles of your menus. Either you use the CSS classes defined in the package, or you fill in all the attributes you need.

#### Classes CSS

[](#classes-css)

You can display a menu with:

```

```

- `menu-slug`: required, the slug of your menu.
- `locale`: optional, defaults to the current locale.
- `title-tag`: optional, `span` by default. Use it to change the title HTML tag if needed (useful for website footers).
- `item-empty-tag`: optional, `span` by default. Use it to change the HTML tag of menu items that are neither links nor HTML blocks.

Here is a sample HTML structure with the CSS classes applied (with a menu slug of `slug-of-menu`):

```

    Title of the menu

            First item

            Second item

                    First sub item

                    Second sub item

                    Third sub item

```

#### Attributes CSS

[](#attributes-css)

```

```

- `locale` : optional, will use the current locale by default
- `container-classes` : optional, `'lfm-'.$menuSlug` by default. Css classes for the menu container (``), can be a string, an array or a Closure taking the menu as single paramater
- `title-classes` : optional, `lfm-title` by default. Css classes for the menu title (``), can be a string, an array or a Closure taking the menu as single paramater
- `list-classes` : optional, `lfm-items-container` by default. Css classes for the menu container of a list of items (``), can be a string, an array or a Closure taking the item menu as single paramater
- `item-container-classes` : `lfm-item-li`, null by default. Css classes for the item menu container (``), can be a string, an array or a Closure taking the item menu as single paramater
- `item-classes` : optional, `lfm-item` by default. Css classes for the item menu (`` or ``), can be a string, an array or a Closure taking the item menu as single paramater
- `item-active-classes` : optional, null by default. Css classes for the active item menu (``), must be a string. `data-active="true"` attribute will be added to the item menu if the item is active.
- `item-contains-active-classes` : optional, null by default. Css classes for item menu containers (``) containing the active item (``), must be a string. `data-active-items="true"` attribute will be added to the item menu if the item is active.

Here the sample of the css classes implemenations in HTML :

```

  Title of the menu

      First item

      Second item

          First sub item

            Second sub item

          Third sub item

```

### Write your own template

[](#write-your-own-template)

#### Template class

[](#template-class)

```
namespace App\Menus\Templates;

use Novius\LaravelFilamentMenu\Concerns\IsMenuTemplate;
use Novius\LaravelFilamentMenu\Contracts\MenuTemplate;

class MyMenuTemplate implements MenuTemplate // Must implement the MenuTemplate interface
{
    use IsMenuTemplate; // This trait defines the required methods with default implementations

    public function key(): string
    {
        return 'my-template';
    }

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

    public function hasTitle(): bool
    {
        return true; // Indicates whether the menu needs a title displayed on the front end
    }

    public function maxDepth(): int
    {
        return 1; // Defines the maximum menu depth
    }

    public function fields(): array
    {
        return [
            \Filament\Forms\Components\DatePicker::make('extras.date'), // You can add additional fields to items; prefix names with `extras.` to store them in the extras field
        ];
    }

    public function casts(): array
    {
        return [
            'date' => 'date:Y-m-d', // Define casts for any additional item fields
        ];
    }

    public function view(): string
    {
        return 'menus.my-template'; // View used to render the menu
    }

    public function viewItem(): string
    {
        return 'menus.my-template-item'; // View used to render individual menu items
    }
}
```

#### Template views

[](#template-views)

First, the view to display the menu:

```
@php
    use Novius\LaravelFilamentMenu\Models\Menu;

    /** @var Menu $menu */
@endphp

    @if ($menu->template->hasTitle())

          {{ $menu->title ?? $menu->name }}

    @endif

        @foreach($items as $item)
            {!! $menu->template->renderItem(
                $menu,
                $item,
                $listClasses,
                $itemContainerClasses,
                $itemClasses,
                $itemEmptyTag,
                $itemActiveClasses,
                $itemContainsActiveClasses
            ) !!}
      @endforeach

```

Then, the view to display an item of the menu:

```
@php
    use Novius\LaravelFilamentMenu\Enums\LinkType;
    use Novius\LaravelFilamentMenu\Models\Menu;
    use Novius\LaravelFilamentMenu\Models\MenuItem;

    /** @var Menu $menu */
    /** @var MenuItem $item */
@endphp
children->isNotEmpty()) data-has-children="true" @endif>
    @if ($item->link_type === LinkType::html)
        {!! $item->html !!}
    @elseif ($item->link_type !== LinkType::empty)
        template->isActiveItem($item) ? $itemActiveClasses : '',
                $item->html_classes
            ])
            @if ($item->target_blank) target="_blank" rel="noopener noreferrer" @endif
            @if ($menu->template->isActiveItem($item)) data-active="true" @endif
        >
            {{ $item->title }}

    @else
        html_classes
            ])
        >
            {{ $item->title }}

    @endif

    @if ($item->children->isNotEmpty())
        template->containsActiveItem($item)) data-active-items="true" @endif
            @class([
                ...$listClasses,
                $menu->template->containsActiveItem($item) ? $itemContainsActiveClasses : '',
            ])
        >
            @foreach($item->children as $item)
                {!! $menu->template->renderItem(
                    $menu,
                    $item
                    $listClasses,
                    $itemContainerClasses,
                    $itemClasses,
                    $itemEmptyTag,
                    $itemActiveClasses,
                    $itemContainsActiveClasses,
                ) !!}
            @endforeach

    @endif

```

### Manage internal links

[](#manage-internal-links)

Laravel Filament Menu uses [Laravel Linkable](https://github.com/novius/laravel-linkable) to manage linkable routes and models. Refer to its documentation for detailed usage instructions.

### Seeder

[](#seeder)

You can use the `\Novius\LaravelFilamentMenu\Database\Seeders\MenuSeeder` to create menus.

Create a new seeder, extend the class, and define the `menus()` method. You can also override the `postCreate()` method to add custom logic.

```
namespace Database\Seeders;

use Novius\LaravelFilamentMenu\Templates\MenuTemplateWithoutTitle;
use Novius\LaravelFilamentMenu\Templates\MenuTemplateWithTitle;

class MenuSeeder extends \Novius\LaravelFilamentMenu\Database\Seeders\MenuSeeder
{
    protected function menus(): array
    {
        return [
            'header' => [
                'name' => 'Header',
                'template' => MenuTemplateWithoutTitle::class,
            ],
            'footer' => [
                'name' => 'Footer',
                'template' => MenuTemplateWithTitle::class,
            ],
        ];
    }

    protected function postCreate(array $config, LocaleData $locale, Menu $menu): void
    {
        // Add custom logic here
    }
}
```

Lint
----

[](#lint)

Run PHP-CS Fixer with:

```
composer run-script lint
```

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

[](#contributing)

Contributions are welcome! Leave an issue on GitHub, or create a Pull Request.

License
-------

[](#license)

This package is under [GNU Affero General Public License v3](http://www.gnu.org/licenses/agpl-3.0.html) or (at your option) any later version.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance84

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

84d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/341860?v=4)[Novius](/maintainers/novius)[@novius](https://github.com/novius)

---

Top Contributors

[![felixgilles](https://avatars.githubusercontent.com/u/900854?v=4)](https://github.com/felixgilles "felixgilles (66 commits)")

---

Tags

laravelmenufilament

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/novius-laravel-filament-menu/health.svg)

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

###  Alternatives

[jibaymcs/filament-tour

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

12247.8k](/packages/jibaymcs-filament-tour)[agencetwogether/hookshelper

Simple plugin to toggle display hooks available in current page.

2312.7k](/packages/agencetwogether-hookshelper)[marcogermani87/filament-cookie-consent

Easy cookie consent integrations for Filament

1917.0k](/packages/marcogermani87-filament-cookie-consent)[wsmallnews/filament-nestedset

Filament nestedset tree builder powered by kalnoy/nestedset with Filament v4 and v5 support

163.0k8](/packages/wsmallnews-filament-nestedset)[cocosmos/filament-quick-add-select

Instantly create and select new options in Filament relationship selects without opening modals

131.3k](/packages/cocosmos-filament-quick-add-select)[tapp/filament-form-builder

User facing form builder using Filament components

131.2k1](/packages/tapp-filament-form-builder)

PHPackages © 2026

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