A fluent interface package for generating HTML menus in Laravel applications.
Spatie Laravel Menu is a PHP package that provides a fluent interface for generating HTML menus in Laravel applications. It solves the problem of building and managing navigation menus by offering an expressive, chainable API that integrates with Laravel's routing and templating systems. The package extends the base Spatie Menu library with Laravel-specific conveniences like action helpers and macros.
Laravel developers who need to build and maintain HTML navigation menus in their web applications, particularly those looking for a clean, expressive alternative to manual menu construction.
Developers choose this package for its seamless Laravel integration, fluent API that improves code readability, and time-saving features like automatic active state management and reusable menu macros.
Html menu generator for Laravel
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The chainable methods, like Menu::new()->action()->setActiveFromRequest(), make menu building readable and reduce boilerplate, as shown in the README example.
It provides Laravel-specific helpers such as action() for URL generation, leveraging Laravel's routing system for easier navigation setup.
Macros allow defining reusable menu templates, ensuring consistent navigation across the application, as demonstrated with Menu::macro('main', ...).
The setActiveFromRequest() method automatically highlights the current menu item based on the request, simplifying active state management.
The README directs users to https://spatie.be/docs/menu for full documentation, which can be inconvenient compared to self-contained docs in the repository.
Upgrading from version 1 requires a dedicated guide, indicating significant changes that could disrupt existing implementations and add migration effort.
It generates clean HTML but leaves all styling to the developer, requiring additional CSS work for visual presentation.