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.
Full Changelog: https://github.com/spatie/menu/compare/3.2.0...3.2.1
->setExactActive() accept a callable as well by @ralphjsmit in https://github.com/spatie/menu/pull/146Full Changelog: https://github.com/spatie/menu/compare/3.1.1...3.2.0
id to docs by @milwad-dev in https://github.com/spatie/menu/pull/144Full Changelog: https://github.com/spatie/menu/compare/3.1.0...3.1.1
id attribute for menu by @milwad-dev in https://github.com/spatie/menu/pull/143Full Changelog: https://github.com/spatie/menu/compare/3.0.1...3.1.0
Items are transformed to string before prepending or appendingmethods_exists check in PHP8Item instances in Menu::prepend so headers can be set activeexact-active class to links that exactly match the current URL. This is accompanied by a setExactActiveClass(string $class) method to set the class nameIteratorAggregate interface to Menu classbeforeRender and willRender hooks that are called when an item is renderedul menus, which allows for Bootstrap 4 compatibilityMenu::setWrapperTag and Menu::withoutWrapperTag to set a custom wrapper tag name for the menu list. Default: ulMenu::setParentTag & Menu::withoutParentTag to determine which tag should be used for the item's parent element. Default: liMenu::setActiveClassOnLink and Menu::setActiveClassOnParent to determine where the active class should be appliedMenu::empty and Html::empty method for adding empty list itemsActiveUrlChecker class for public useappend and prepend methods to Linkfill and buildif function$initial parameter in Menu::build^1.0.0 of spatie/urlMenu::build and non-static Menu::fill methods to create menu's from arrays.setActive method on Activatable now also accepts a non-strict boolean or callable parameter to set $active to true or false.Menu::html and Menu::htmlIf now accept a $parentAttributes array as their second arguments.HtmlAttributes and ParentAttributes traits have been renamed to HasHtmlAttributes and HasParentAttributes.HasUrl interface and trait has been removed. Url-related methods now also are part of the Activatable interface and trait.void and voidIf have been removed. These can be replaced by html and htmlIf, with empty strings as their first argumentsprefixLinks and prefixUrls methods have been removed because they were too unpredictable in some case. There currently isn't an alternative for these, besides writing your own logic and applying it with applyToAll.HasUrl traitprefixLinks in favor of prefixUrlssubmenuIfNew methods on Menu:
submenu for submenus with optional headersvoid and voidIf for empty list itemswrap to wrap the menu in an html tag with optional attributesblueprint method to copy the menu without it's contentsaddItemClass, setItemAttributeaddItemParentClass, setItemParentAttributeAdded HasHtmlAttributes and HasParentAttributes interfaces
HtmlAttributes and ParentAttributes now also have a setAttributes method
setActive when setting active from a URLadd functions, addIf, linkIf and htmlIfHow can I help you explore Laravel packages today?