Weave Code
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

Menu Laravel Package

spatie/menu

Fluent, extensible menu builder for Laravel. Compose navigation with a clean API, render as HTML, and customize output via presenters and macros. Supports active state handling, links, submenus, and easy integration with Blade and your app’s routing.

View on GitHub
Deep Wiki
Context7

title: Views as Menu Items weight: 2

laravel-menu ships with a View item type, which you can use to render views as menu items. Views are created by specifying the view's name, and optionally passing data.

Menu::new()
    ->add(View::create('greeting', ['name' => 'Sebastian']));
<!-- resources/views/greeting.blade.php -->
Hello, {{ $name }}!
<ul>
    <li>
        Hello, Sebastian!
    </li>
</ul>

If url is set in the data argument, it will be used to determine the active state of the view with setActiveFromUrl or setActiveFromRequest.

Menu::new()
    ->add(View::create('greeting', ['name' => 'Sebastian', 'url' => '/profile']))
    ->setActiveFromUrl('/profile');
<ul>
    <li class="active">
        Hello, Sebastian!
    </li>
</ul>

Additionally, an $active boolean will always be passed to the view.

<!-- resources/views/amIActive.blade.php -->
I'm {{ $active ? 'active' : 'inactive' }}!
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle