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

Menu Builder Bundle Laravel Package

happyr/menu-builder-bundle

A Symfony bundle that simplifies creating and managing navigation menus. Define menu items and hierarchies in configuration or code, then render them in Twig templates with a clean, flexible API. Useful for site navigation, admin sidebars, and reusable menu structures.

View on GitHub
Deep Wiki
Context7

Getting Started

Before anything else: this is a Symfony bundle, not a Laravel package. There is still no Laravel integration — no service provider, no facade, no config stub. You cannot composer require it into a Laravel app and expect it to work. The assessment below assumes a Symfony project, which is the only context where this package makes sense.

What 0.2.1 changes for a first-time evaluator:

  1. PHP 8 is now supported. Previously the composer.json almost certainly pinned PHP 7.x, which meant a hard stop on modern runtimes. That ceiling is gone. The Symfony constraint is a separate question and was not mentioned in the release notes — check it explicitly. PHP 8 support strongly suggests Symfony 5.4-era compatibility; do not assume Symfony 6/7 works.
  2. composer require happyr/menu-builder-bundle — then run composer update --dry-run in isolation before committing. A resolve failure is your signal to stop.
  3. Register the bundle in config/bundles.php (verify the class name in src/ rather than guessing).
  4. Read src/ first. The bundle is small enough to read end-to-end in minutes, and it remains more reliable than the docs. Identify four things now: the menu builder service, the menu item model, the new active method on items, and any Twig extension.
  5. First use case: build a single static nav in a dedicated builder service, mark the item matching the current route as active, expose it to a base template, render it. That is still the entire happy path.

The release cadence improvement (first release since 2021) is a mildly positive signal, but 2 stars and zero dependents still mean you are effectively the only consumer. Budget accordingly.

Implementation Patterns

Treat it as a small utility, not a framework feature. The new active method is the main thing that changes your day-to-day code.

  • Build menus in a service, not a controller. A MenuBuilder-style service that assembles items (label, URL or route, children, attributes, active flag) stays testable and cacheable. Inject it where needed.
  • Use the new active method instead of hand-rolling an is_active attribute. Set it in the builder by comparing the item's route against the current route name (inject RequestStack or pass the route name in), then let your Twig template branch on it. This is a real ergonomic win — previously you were smuggling boolean state through the attributes array and re-checking it in templates.
  • Active state is still your matching logic. The release adds the flag, not automatic current-route detection. Multi-item cases (section roots, prefix matching, _route parameters) are yours to implement. Consider a small isCurrentRoute() helper on your builder so templates stay dumb.
  • Render via the Twig extension (if present). Verify the function name in source. If you need active-aware markup and the bundled renderer doesn't expose the flag, render the tree yourself with a recursive {% macro %} — for a menu this small, that is often cleaner than fighting the extension.
  • Compose with a layout template. Render once in base.html.twig, inherit in children. Avoid rebuilding per request.
  • Access control filtering. Still not provided. Filter items in the builder using AuthorizationCheckerInterface (or the Security helper on older Symfony). Combine with the active flag so a filtered-out item can't be rendered as active.
  • Integration tip: if you need voters, matchers, translation-heavy labels, or KnpMenu-style providers, evaluate KnpMenuBundle first. It remains the de facto standard and far better supported. The active method narrows the gap slightly but does not close it.

Gotchas and Tips

  • Framework mismatch is still the biggest gotcha. Symfony bundle. No Laravel path. No amount of composer require changes that.
  • PHP 8 support ≠ Symfony 6/7 support. These are independent constraints. The release notes only claim PHP 8. Test dependency resolution against your actual Symfony version; expect a ceiling around Symfony 5.
  • The active method is a flag, not a feature. Don't assume it inspects the request, the router, or the current URL. Confirm its signature in src/ — whether it's setActive(bool)/isActive(), a fluent active(), or something route-aware — before writing templates against it.
  • Maintenance risk is reduced but not resolved. A 2026-era 0.2.1 bump after a multi-year gap is a good sign, not a guarantee of ongoing triage. Still no community, no issue momentum, no visible security patch path. Vendor or fork if this becomes load-bearing.
  • Sparse documentation. The README almost certainly wasn't rewritten for 0.2.1. The active method may be entirely undocumented. Read src/.
  • Still missing out of the box: current-route detection, role filtering, and caching. All three are straightforward extension points in your own builder — that's the pattern that keeps this package viable.
  • Debugging: undefined Twig function → bundle not registered or extension not autoloaded. Use bin/console debug:twig and debug:container to confirm service IDs. If active throws a "call to undefined method" you're on the wrong installed version — check composer show happyr/menu-builder-bundle.
  • Bottom line: 0.2.1 makes this meaningfully more usable — PHP 8 and a first-class active flag remove two of the previous sticking points. It's now a reasonable choice for a trivial static Symfony menu on a compatible Symfony version. For anything production-critical, long-lived, or feature-rich, KnpMenuBundle is still the answer.
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.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core