PHPackages                             kraenkvisuell/nova-menu-builder - 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. kraenkvisuell/nova-menu-builder

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

kraenkvisuell/nova-menu-builder
===============================

This Laravel Nova package allows you to create and manage menus and menu items.

v8.0.2(4y ago)03731MITPHPPHP ^8.0.2|^8.1

Since Mar 12Pushed 3mo agoCompare

[ Source](https://github.com/kraenkvisuell/nova-menu-builder)[ Packagist](https://packagist.org/packages/kraenkvisuell/nova-menu-builder)[ GitHub Sponsors](https://github.com/optimistdigital)[ RSS](/packages/kraenkvisuell-nova-menu-builder/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (5)Versions (87)Used By (1)

Nova Menu Builder
=================

[](#nova-menu-builder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3892bfa8a70342f56da30c805929dba1774c09302254ab1c4be85dfe367b0924/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7074696d6973746469676974616c2f6e6f76612d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/optimistdigital/nova-menu-builder)[![Total Downloads](https://camo.githubusercontent.com/8ac4908b11538e5cb91baa8b066eeb24d593503abb28dcd1bf0079d6eff144c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f7074696d6973746469676974616c2f6e6f76612d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/optimistdigital/nova-menu-builder)

This [Laravel Nova](https://nova.laravel.com/) package allows you to create and manage menus and menu items.

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

[](#requirements)

- `php: >=7.2`
- `laravel/nova: ^3.0`

Features
--------

[](#features)

- Menu management
- Menu items management
    - Simple drag-and-drop nesting and re-ordering
- Custom menu item types support
    - Ability to easily add select types
    - Ability to add custom fields
    - Use `menubuilder:type` command to easily create new types
- Fully localizable

Screenshots
-----------

[](#screenshots)

[![Menu Detail View](docs/menu-detail.png)](docs/menu-detail.png)

[![Menu Item Edit](docs/menu-item-edit.png)](docs/menu-item-edit.png)

Installation and Setup
----------------------

[](#installation-and-setup)

### Installing the package

[](#installing-the-package)

Install the package in a Laravel Nova project via Composer, edit the configuration file and run migrations.

```
# Install the package
composer require optimistdigital/nova-menu-builder

# Publish the configuration file and edit it to your preference
# NB! If you want custom table names, configure them before running the migrations.
php artisan vendor:publish --tag=nova-menu-builder-config
```

Register the tool with Nova in the `tools()` method of the `NovaServiceProvider`:

```
// in app/Providers/NovaServiceProvider.php

public function tools()
{
    return [
        // ...
        new \KraenkVisuell\MenuBuilder\MenuBuilder,
    ];
}
```

### Setting up

[](#setting-up)

After publishing the configuration file, you have to make some required changes in the config:

```
# Choose table names of your liking by editing the two key/values:
'menus_table_name' => 'nova_menu_menus',
'menu_items_table_name' => 'nova_menu_menu_items',

# Define the locales for your project:
# If your project doesn't have localization, you can just leave it as it is.
# When there's just one locale, anything related to localization isn't displayed.
'locales' => ['en_US' => 'English'],

# Define the list of possible menus (ie 'footer', 'header', 'main-menu'):
'menus' => [
    // 'header' => [
    //     'name' => 'Header',
    //     'unique' => true,
    //     'menu_item_types' => []
    // ]
],

# If you're just setting up, this is probably of no importance to you,
# but later on, when you want custom menu item types with custom fields
# , you can register them here:
'menu_item_types' => [],
```

Next, just run the migrations and you're set.

```
# Run the automatically loaded migrations
php artisan migrate
```

### Optionally publish migrations

[](#optionally-publish-migrations)

This is only useful if you want to overwrite migrations and models. If you wish to use the menu builder as it comes out of the box, you don't need them.

```
# Publish migrations to overwrite them (optional)
php artisan vendor:publish --tag=nova-menu-builder-migrations
```

Usage
-----

[](#usage)

### Locales configuration

[](#locales-configuration)

You can define the locales for the menus in the config file, as shown below.

```
// in config/nova-menu.php

return [
  // ...
  'locales' => [
    'en' => 'English',
    'et' => 'Estonian',
  ],

  // or using a closure (not cacheable):

  'locales' => function() {
    return nova_lang_get_locales();
  }

  // or if you want to use a function, but still be able to cache it:

  'locales' => '\App\Configuration\NovaMenuConfiguration@getLocales',

  // or

  'locales' => 'nova_lang_get_locales',
  // ...
];
```

### Custom menu item types

[](#custom-menu-item-types)

Menu builder allows you create custom menu item types with custom fields.

Create a class that extends the `KraenkVisuell\MenuBuilder\MenuItemTypes\BaseMenuItemType` class and register it in the config file.

```
// in config/nova-menu.php

return [
  // ...
  'menu_item_types' => [
    \App\MenuItemTypes\CustomMenuItemType::class,
  ],
  // ...
];
```

In the created class, overwrite the following methods:

```
/**
 * Get the menu link identifier that can be used to tell different custom
 * links apart (ie 'page' or 'product').
 *
 * @return string
 **/
public static function getIdentifier(): string {
    // Example usecase
    // return 'page';
    return '';
}

/**
 * Get menu link name shown in  a dropdown in CMS when selecting link type
 * ie ('Product Link').
 *
 * @return string
 **/
public static function getName(): string {
    // Example usecase
    // return 'Page Link';
    return '';
}

/**
 * Get list of options shown in a select dropdown.
 *
 * Should be a map of [key => value, ...], where key is a unique identifier
 * and value is the displayed string.
 *
 * @return array
 **/
public static function getOptions($locale): array {
    // Example usecase
    // return Page::all()->pluck('name', 'id')->toArray();
    return [];
}

/**
 * Get the subtitle value shown in CMS menu items list.
 *
 * @param $value
 * @param $data The data from item fields.
 * @param $locale
 * @return string
 **/
public static function getDisplayValue($value, ?array $data, $locale) {
    // Example usecase
    // return 'Page: ' . Page::find($value)->name;
    return $value;
}

/**
 * Get the value of the link visible to the front-end.
 *
 * Can be anything. It is up to you how you will handle parsing it.
 *
 * This will only be called when using the nova_get_menu()
 * and nova_get_menus() helpers or when you call formatForAPI()
 * on the Menu model.
 *
 * @param $value The key from options list that was selected.
 * @param $data The data from item fields.
 * @param $locale
 * @return any
 */
public static function getValue($value, ?array $data, $locale)
{
    return $value;
}

/**
 * Get the fields displayed by the resource.
 *
 * @return array An array of fields.
 */
public static function getFields(): array
{
    return [];
}

/**
 * Get the rules for the resource.
 *
 * @return array A key-value map of attributes and rules.
 */
public static function getRules(): array
{
    return [];
}

/**
 * Get data of the link visible to the front-end.
 *
 * Can be anything. It is up to you how you will handle parsing it.
 *
 * This will only be called when using the nova_get_menu()
 * and nova_get_menus() helpers or when you call formatForAPI()
 * on the Menu model.
 *
 * @param null $data Field values
 * @return any
 */
public static function getData($data = null)
{
    return $data;
}
```

### Returning the menus in a JSON API

[](#returning-the-menus-in-a-json-api)

#### nova\_get\_menus()

[](#nova_get_menus)

A helper function `nova_get_menus` is globally registered in this package which returns all the menus including their menu items in an API friendly format.

```
public function getMenus(Request $request) {
    $menusResponse = nova_get_menus();
    return response()->json($menusResponse);
}
```

#### nova\_get\_menu\_by\_slug($menuSlug, $locale = null)

[](#nova_get_menu_by_slugmenuslug-locale--null)

To get a single menu, you can use the helper function `nova_get_menu_by_slug('slug', 'en')`. Returns null if no menu with the slug is found or returns the menu if it is found. If no locale is passed, the helper will automatically choose the first configured locale.

Credits
-------

[](#credits)

- [Tarvo Reinpalu](https://github.com/Tarpsvo)
- [Eric Lagarda (original nova-menu-builder)](https://github.com/Krato)
- [Ralph Huwiler (vue-nestable)](https://github.com/rhwilr/vue-nestable)

License
-------

[](#license)

Nova Menu Builder is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

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

Every ~13 days

Total

86

Last Release

1497d ago

Major Versions

2.3.9 → 4.0.32020-10-29

4.1.2 → 5.0.02020-11-23

5.3.3 → 6.0.02021-08-10

6.1.1 → v7.0.02022-02-09

v7.0.0 → v8.0.02022-04-06

PHP version history (3 changes)1.0.0PHP &gt;=7.1.0

5.0.0PHP &gt;=7.2.0

v8.0.0PHP ^8.0.2|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/bbdadd3d1931366139b27d9b8a39e7edc03cb99aa82ee126e54c77ac089d4d0c?d=identicon)[manogi](/maintainers/manogi)

---

Top Contributors

[![Tarpsvo](https://avatars.githubusercontent.com/u/2018660?v=4)](https://github.com/Tarpsvo "Tarpsvo (400 commits)")[![bastihilger](https://avatars.githubusercontent.com/u/1419634?v=4)](https://github.com/bastihilger "bastihilger (7 commits)")[![Ragash](https://avatars.githubusercontent.com/u/11633050?v=4)](https://github.com/Ragash "Ragash (4 commits)")[![omarhen](https://avatars.githubusercontent.com/u/5448144?v=4)](https://github.com/omarhen "omarhen (4 commits)")[![kaareloun](https://avatars.githubusercontent.com/u/19284921?v=4)](https://github.com/kaareloun "kaareloun (4 commits)")[![ArroWsGM](https://avatars.githubusercontent.com/u/9962071?v=4)](https://github.com/ArroWsGM "ArroWsGM (3 commits)")[![Krato](https://avatars.githubusercontent.com/u/74367?v=4)](https://github.com/Krato "Krato (3 commits)")[![slovenianGooner](https://avatars.githubusercontent.com/u/1257629?v=4)](https://github.com/slovenianGooner "slovenianGooner (2 commits)")[![harmenjanssen](https://avatars.githubusercontent.com/u/803176?v=4)](https://github.com/harmenjanssen "harmenjanssen (2 commits)")[![jianongHe](https://avatars.githubusercontent.com/u/39476157?v=4)](https://github.com/jianongHe "jianongHe (2 commits)")[![Jimmylet](https://avatars.githubusercontent.com/u/17065517?v=4)](https://github.com/Jimmylet "Jimmylet (2 commits)")[![kikoseijo](https://avatars.githubusercontent.com/u/1528668?v=4)](https://github.com/kikoseijo "kikoseijo (2 commits)")[![rdaitan-cp](https://avatars.githubusercontent.com/u/66294995?v=4)](https://github.com/rdaitan-cp "rdaitan-cp (1 commits)")[![ttungbmt](https://avatars.githubusercontent.com/u/12232155?v=4)](https://github.com/ttungbmt "ttungbmt (1 commits)")[![veezex](https://avatars.githubusercontent.com/u/5464447?v=4)](https://github.com/veezex "veezex (1 commits)")[![webbash](https://avatars.githubusercontent.com/u/20628613?v=4)](https://github.com/webbash "webbash (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![eleriojavere](https://avatars.githubusercontent.com/u/61348526?v=4)](https://github.com/eleriojavere "eleriojavere (1 commits)")[![ExileofAranei](https://avatars.githubusercontent.com/u/41694699?v=4)](https://github.com/ExileofAranei "ExileofAranei (1 commits)")[![jordythevulder](https://avatars.githubusercontent.com/u/28647869?v=4)](https://github.com/jordythevulder "jordythevulder (1 commits)")

---

Tags

laravelbuildermenunovaoptimistdigital

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kraenkvisuell-nova-menu-builder/health.svg)

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

###  Alternatives

[optimistdigital/nova-menu-builder

This Laravel Nova package allows you to create and manage menus and menu items.

243369.4k](/packages/optimistdigital-nova-menu-builder)[outl1ne/nova-menu-builder

This Laravel Nova package allows you to create and manage menus and menu items.

243246.0k3](/packages/outl1ne-nova-menu-builder)[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

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