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

Config Knp Menu Bundle Laravel Package

jbouzekri/config-knp-menu-bundle

A Symfony bundle that brings configuration-driven menus to KnpMenuBundle, letting you define navigation menus in YAML instead of PHP. It simplifies menu setup and maintenance while leveraging KnpMenu’s rendering, extensions, and Symfony integration.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • This is a Symfony bundle, not a Laravel package — it hooks into Symfony's bundle system, DI container, and config tree. It has no Laravel service provider, facade, or config publishing story. Fit is only positive if the target application is Symfony. Release 7.1 changes nothing here.
  • Within a Symfony app, it sits as a thin declarative layer over knplabs/knp-menu-bundle: menus are declared in YAML across bundles, merged via the container config tree, and resolved through KnpMenu's MenuProvider/FactoryInterface at runtime.
  • It complements, rather than replaces, KnpMenu. Menus that are purely static (navigation trees, admin sidebars, footer links, docs TOC) are a clean fit. Menus requiring runtime data (permission-filtered items, entity-driven trees, badges/counters) still belong in PHP MenuBuilder classes, so expect a hybrid model rather than a full migration.
  • New in 7.1: nested extras. Menu items can now carry arbitrarily nested metadata structures in YAML rather than flat key/value pairs. This is a genuine, if narrow, widening of the static fit: menus whose only "dynamic" element was rich per-item presentation metadata (icon sets, nested badge config, dropdown grouping attributes, structured route parameters) can now stay declarative instead of falling back to a MenuBuilder. It does not move the line on data-driven menus (permission filtering, entity trees) — extras are static data baked at config time, not runtime lookups.

Integration feasibility

  • Small, legible codebase: a bundle class, a config tree, and a compiler/build step. A competent Symfony developer can read the whole thing in an hour, which materially lowers the due-diligence cost of adopting a thinly-maintained dependency.
  • Requires a working KnpMenuBundle integration first. If the application already renders menus through KnpMenu, adoption is a config-only change per menu. If it does not, this package adds a dependency chain (knp-menu, knp-menu-bundle, plus this bundle) before delivering any value.
  • Composer constraints remain the main gate. The 7.1 release proves the package is not frozen, but a feature PR is not evidence of Symfony-version currency — re-run composer why-not against our pinned Symfony and KnpMenu versions before drawing any conclusion. A 7.x line may align with Symfony 7, but that must be verified from composer.json, not inferred from the version number.
  • Consumption side matters for the new feature: nested extras are only worth adopting if our Twig templates or renderer actually read extras. A flat-extras renderer will silently ignore nested structures.

Technical risk

  • Low code risk, moderate-high ecosystem risk — marginally improved. The failure surface is small, and 7.1 is the first counter-signal to the "effectively unmaintained" read: a release, a named external contributor (@Baachi), and a merged community PR. That reduces — but does not remove — abandonment risk. Single maintainer, tiny star count, and no dependents remain true; treat it as low-activity, not maintained.
  • Bus factor is still 1 on merge rights. No dependents means no downstream users are stress-testing it against new Symfony releases, so breakage will surface on our upgrade path, not theirs.
  • Release hygiene risk is unchanged and now slightly more relevant. The 7.1 notes are a one-line thank-you with no changelog entry, no migration note, and no confirmation of whether the config schema changed. For a feature that touches config-tree shape (nested arrays under extras), assume nothing — diff the config tree class between our pinned version and 7.1.
  • There is a subtle governance risk in moving menu structure into YAML: menu definitions often quietly encode authorization intent ("only admins see this item"). YAML placement makes that look like configuration rather than security logic, which invites misuse. Nested extras sharpen this — an extras.roles: [ROLE_ADMIN] convention is now easy to invent and easy to mistake for enforcement. Menu visibility must never be the access-control boundary.

Key questions

  • Is the target application Symfony or Laravel? On Laravel, this evaluation ends — no viable path, evaluate spatie/menu or lavary/laravel-menu instead.
  • Do we already have KnpMenuBundle in production, and how many MenuBuilder classes exist today?
  • What percentage of our menus are static versus data/permission-driven? Anything below ~60% static weakens the case considerably.
  • Does 7.1 widen the declared Symfony and KnpMenu constraints, or is it a feature-only release on the existing range? This determines whether 7.1 is adoptable now or only via a fork.
  • Do our renderers consume extras? If yes, does nested-extras support require template changes on our side, and is the nested shape validated anywhere?
  • If the maintainer disappears, are we willing to vendor the bundle or maintain a fork? The code is small enough that "yes" is plausible, but it should be an explicit decision, not a surprise.

Integration Approach

Stack fit

  • Symfony 5/6-era applications using KnpMenuBundle: strong fit for static menus, neutral for dynamic ones.
  • Laravel applications: no fit. Do not attempt to bridge this via a custom service provider; the value is in the Symfony config-tree merge behavior, which does not translate.
  • Mixed or legacy PHP applications without a DI container config system: poor fit, since the package's core mechanism is config merging across bundles.

Migration path

  • Install and register the bundle alongside the existing KnpMenu setup — additive, not a cutover.
  • Port one low-risk menu first (e.g., a footer or static admin sidebar) from its MenuBuilder to YAML, render it in a non-production branch, and diff the output HTML against the current implementation.
  • Use 7.1's nested extras only where a PHP builder was retained solely for presentation metadata. That is the specific porting case the release unlocks; do not let it become a reason to re-litigate menus that are genuinely data-driven.
  • Leave dynamic menus in PHP. Where a menu is mixed, keep the PHP builder and let it delegate static subtrees to the YAML-defined menu.
  • Delete the corresponding MenuBuilder classes only after the YAML version has run in production for a full release cycle.

Compatibility

  • Target 7.1 explicitly in the spike, and re-run composer why-not against our pinned Symfony and KnpMenu versions. If 7.1 still sits inside the 2023-era constraint range, the Symfony 7 fork question stands unresolved regardless of the new release.
  • Diff the bundle's config tree class between our current pin and 7.1 to confirm the nested-extras change is additive and no existing key semantics shifted.
  • Confirm the bundle's config caching behavior: menu definitions should be compiled into the container cache, not re-parsed per request. Nested arrays are more expensive to validate at warmup — verify the additional structure does not push work to runtime. If YAML is read at runtime, that is a performance and failure-mode regression worth patching.
  • Check translation integration — KnpMenu labels typically route through the translator; confirm labels declared in YAML are translatable and that extraction tooling still picks them up. Nested extras are a new place for user-facing strings to hide from extraction; decide whether extras may contain display text at all.

Sequencing

  1. Framework confirmation and dependency audit against 7.1 (half a day).
  2. Spike: one static menu in YAML in a feature branch, rendered and diffed (1–2 days).
  3. Decision gate: adopt 7.1, fork, or build a ~200-line internal equivalent. Given the package's size, "build internal" remains a legitimate outcome and removes the maintenance question entirely. Note that if we fork, the nested-extras change is small enough to backport to an internal equivalent cheaply.
  4. If adopted, roll out menu-by-menu across one or two sprints, with each menu gated on a visual regression check.
  5. Document the YAML schema — including the nested-extras shape — and the static/dynamic boundary in the team's engineering notes before the second developer touches it.

Operational Impact

Maintenance

  • Upstream is low-activity, not dormant. One release and one external contributor after a long gap is a weak but real signal of life. It does not justify removing the fork/vendor contingency; it does justify not treating the package as a dead end.
  • Budget for a fork or a vendored copy pinned to a specific commit, and assign a named owner. Without an owner, this becomes an orphaned dependency discovered during the next framework upgrade. Pin to 7.1 rather than a floating range so a future surprise release cannot land unreviewed.
  • The fork burden is genuinely small — the diff surface is narrow — but it is recurring work tied to Symfony major releases, not a one-time cost.

Support

  • No commercial support, no active issue triage, no security response process. A community PR being merged is not a support commitment. Our own team is the support channel.
  • Mitigate by keeping the dependency isolated: no other internal packages should depend on it directly, so replacement remains a single-package swap.

Scaling

  • Runtime cost is effectively zero if menu definitions compile into the container cache. Menu rendering cost is dominated by KnpMenu and the renderer, not by this bundle.
  • Configuration volume scales acceptably to dozens of menus; beyond that, YAML files across many bundles become hard to trace, and discoverability degrades. Nested extras accelerate this — deeply structured metadata spread across bundle config files is harder to grep and review than flat keys. At that point a single consolidated config or a PHP-based definition is easier to reason about.
  • Team scaling is the real constraint: YAML menus are easy for a newcomer to edit and easy for them to break silently, since there is no type checking on menu structure — and now no type checking on nested structure either.

Failure modes

  • Cache warmup failure on malformed YAML or an unrecognized config key — deploy-blocking, and the error message may point at the config tree rather than the offending file. Nesting increases the odds of a structural mistake reaching this stage.
  • Silent metadata loss when a nested extras structure does not match what the renderer expects: the menu still renders, items still appear, but icons/badges/attributes quietly vanish. This is the new failure mode introduced by 7.1 and it is the hardest to catch in code review.
  • Silent menu disappearance when a config key is renamed or a bundle's config is not loaded; menus render empty rather than erroring, so it can reach production unnoticed.
  • Upgrade deadlock when Symfony or KnpMenu moves ahead of the package's constraints, forcing an emergency fork mid-upgrade.
  • Authorization leakage if menu visibility is treated as access control — items hidden from the menu remain routable unless the controller enforces permissions independently.

Ramp-up

  • A Symfony developer familiar with KnpMenu needs roughly half a day to be productive; a developer unfamiliar with KnpMenu needs one to two days, mostly on KnpMenu's factory and provider model rather than this bundle.
  • Nested extras adds a short step: whoever owns the templates must know the expected extras shape, because neither the bundle nor PHP will enforce it. Write that shape down.
  • Onboarding cost is low but non-zero and undocumented externally — expect to write the internal README ourselves.
  • The practical recommendation stands: run the spike on 7.1 and keep "build a small internal equivalent" as a first-class alternative rather than a fallback. The new release improves the package's standing slightly; it does not change the shape of the decision.
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