Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Menu

Laravel Menu Laravel Package

salahhusa9/laravel-menu

Laravel Menu is a lightweight package for defining and rendering navigation menus in Laravel. Build nested items with routes or URLs, highlight active links, and customize Blade output for simpler sidebar and header navigation.

View on GitHub
Deep Wiki
Context7

This is a useful package for building menus in your Laravel application, and it can help simplify the process of creating and managing menus in your application.

Frequently asked questions about Laravel Menu
How do I install salahhusa9/laravel-menu in a Laravel application?
Install the package with Composer using composer require salahhusa9/laravel-menu. In a standard Laravel app, package auto-discovery should register the service provider, but you can also register it manually if needed. After installation, define your menus and render them in your Blade templates.
Which Laravel and PHP versions are supported by laravel-menu?
The exact Laravel and PHP constraints are defined in the package's composer.json, so check those before adopting it. The package is a conventional Laravel package intended for Blade/server-rendered navigation. Version 1.1.2 is additive and maintenance-focused, but you should still confirm compatibility against your application's runtime.
How do I define menu items with routes or URLs in Laravel Menu?
Menus are typically defined in a service provider or configuration layer, with items pointing to Laravel route names or plain URLs. You can build primary navigation, admin menus, account menus, or sidebar menus and then render them from Blade. Start with one menu surface as a proof of concept before migrating existing hard-coded menus.
How do I create nested menu items with salahhusa9/laravel-menu?
The package supports nested menu items so you can build parent and child navigation structures. Define the hierarchy in your menu configuration and let the package render the nested output in Blade. For complex existing menus, compare the rendered structure against your current custom menu code before rolling it out broadly.
How does active link highlighting work in Laravel Menu?
Laravel Menu includes active-state handling so menu items can be highlighted when they match the current route or URL. This is useful for sidebars and header navigation where developers normally write custom active-class logic. Validate the behavior for route parameters, wildcards, and nested items in your application.
How do I add badges to Laravel menu items?
Menu items support badges, and version 1.1.2 adds support for badgeName to be a Closure. This lets you compute a badge label dynamically at render time. Keep badge logic simple and avoid expensive database queries or remote calls inside badge closures unless you cache the results.
Can badgeName be a Closure, and what should it return?
Yes, v1.1.2 adds closure support for badgeName as an additive feature. The closure is evaluated during menu rendering, so it should return a string suitable for display. Check how null or invalid values are handled in the package source, and add a focused test for your closure-based badges.
How do I customize the Blade output for Laravel menus?
Laravel Menu is designed for Blade/server-rendered navigation, so you can customize the rendered menu output for your sidebar or header markup. It is not a general-purpose UI component library, so keep customization focused on navigation presentation. Use the package's Blade output as a starting point and adapt it to your application's CSS and accessibility requirements.
How should I test menu rendering and closure-based badges?
Add tests that render a representative menu and assert the expected links, active states, nested structure, and badge labels. For closure-based badgeName, include a test that proves the closure is called and returns the expected string. Run your application test suite after pinning the package version and before deploying to staging or production.
Is laravel-menu suitable for high-traffic production apps, and is it actively maintained?
Menu rendering is generally not a scaling bottleneck, but closure-based badges can introduce hidden latency if each closure performs I/O. Cache rendered menus or precompute badge values for high-traffic pages, and test cache invalidation with dynamic badges. Version 1.1.2 shows dependency and CI maintenance, but support is likely community/maintainer-driven, so track upstream Laravel and PHP support. Alternatives include custom Blade menu partials or other Laravel menu packages if your needs outgrow it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core