kylemassacre/laravel-menus

Laravel Menu management

Maintainers

👁 KyleMassacre

Package info

github.com/KyleMassacre/laravel-menus

pkg:composer/kylemassacre/laravel-menus

Statistics

Installs: 14

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

12.0 2025-04-26 22:49 UTC

Requires

Requires (Dev)

Suggests

  • spatie/laravel-html: A modern alternative to laravelcollective/html which is no longer supported

Provides

None

Conflicts

None

Replaces

None

MIT e2a288746e2ca39476c944f53b6228632ded2cc5

  • Nicolas Widart <n.widart.woop@gmail.com>
  • Pingpong Labs <pingpong.labs.woop@gmail.com>
  • Kyle Ellis <ky.ellis83.woop@gmail.com>

bootstrapnavigationlaravelnavmenus

This package is auto-updated.

Last update: 2026-06-27 01:34:07 UTC


README

Usage Example

To create menus in your Laravel application, you should create a file at app/Support/menus.php. This file will be automatically loaded by the package's service provider.

Basic Menu Creation

<?php

use KyleMassacre\Menus\Facades\Menu;
use KyleMassacre\Menus\MenuBuilder;

// Create a menu
Menu::create('main-menu', function (MenuBuilder $menu) {
 // Add items to the menu
 $menu->add([
 'route' => 'home',
 'title' => 'Home',
 'icon' => 'fa fa-home fa-fw me-2',
 ]);
 
 // Add a menu item with a URL instead of a route
 $menu->add([
 'url' => '/about',
 'title' => 'About',
 'icon' => 'fa fa-info fa-fw me-2',
 ]);
 
 // Add a dropdown menu
 $menu->dropdown('User', function ($sub) {
 $sub->add([
 'route' => 'profile',
 'title' => 'Profile',
 'icon' => 'fa fa-user fa-fw me-2',
 ]);
 $sub->add([
 'route' => 'logout',
 'title' => 'Logout',
 'icon' => 'fa fa-sign-out fa-fw me-2',
 ]);
 });
});

Rendering Menus

To render a menu in your blade templates:

{!! Menu::render('main-menu') !!}

Or with a specific presenter:

{!! Menu::render('main-menu', 'App\\Http\\Presenters\\MainMenuPresenter') !!}

Important Notes

  1. Ensure your routes are defined before creating menus that reference them
  2. For route-based menu items, use 'route' => 'route.name' or 'route' => ['route.name', ['param' => 'value']] for routes with parameters
  3. For URL-based menu items, use 'url' => '/path/to/page'

Laravel Menus

👁 Latest Version on Packagist
👁 Software License
👁 GitHub Actions Workflow Status
👁 Scrutinizer Coverage
👁 Scrutinizer quality (GitHub/Bitbucket) with branch
👁 Total Downloads

kylemassacre/laravel-menus is a laravel package which created to manage menus. It has a feature called presenters which enables easy styling and custom structure of menu rendering.

This package is a re-published, re-organised and maintained version of nwidart/laravel-menus, which isn't maintained anymore. This package is used in AsgardCMS.

With one big added bonus that the original package didn't have: tests.

Documentation

You'll find installation instructions and full documentation on https://nwidart.com/laravel-menus/.

Credits

License

The MIT License (MIT). Please see License File for more information.