- Is jbouzekri/config-knp-menu-bundle a Laravel package?
- No. It is a Symfony bundle that hooks into Symfony's bundle system, DI container, and config tree, and it has no Laravel service provider, facade, or config publishing story. Laravel applications cannot use it without the Symfony bundle infrastructure. For Laravel menus, use a Laravel-specific package or define menus in PHP instead.
- How do I install jbouzekri/config-knp-menu-bundle?
- Install it with Composer and register the bundle in your Symfony application's bundle configuration. You must already have a working KnpMenuBundle integration, because this bundle is a thin declarative layer over KnpMenu rather than a replacement. Once enabled, define menus in YAML and resolve them through KnpMenu's menu provider and factory.
- Can I define nested menu trees in YAML with this bundle?
- Yes. The bundle lets you describe nested menu items with labels, links, and item options in configuration, then converts them into native KnpMenu items. Version 7.1 also adds nested extras, so menu items can carry arbitrarily nested metadata structures in YAML instead of only flat key/value pairs. This is useful for static navigation trees, admin sidebars, footer links, and documentation tables of contents.
- Does this bundle support Symfony 7 or Laravel 11?
- It has no Laravel support at all because it is a Symfony bundle. Symfony 7 compatibility should not be inferred from the 7.1 release number; check composer.json constraints and run composer why-not against your pinned Symfony and KnpMenu versions. The 7.1 release shows the package is not frozen, but a feature pull request is not proof of Symfony-version currency.
- When should I use YAML menus instead of a PHP MenuBuilder?
- Use YAML menus for mostly static trees such as main navigation, admin sidebars, footer links, and docs tables of contents. Menus that need runtime data, including permission-filtered items, entity-driven trees, badges, and counters, still belong in PHP MenuBuilder classes. Expect a hybrid model rather than a full migration, because extras are static data baked at config time and are not runtime lookups.
- How do I test menus defined with config-knp-menu-bundle?
- Because menus are resolved through KnpMenu's MenuProvider and FactoryInterface at runtime, test them through the Symfony container or a KernelTestCase. Fetch the menu by name and assert its children, labels, URIs, and extras. Also test configuration merging across bundles if your application defines menus in more than one place.
- What are the production risks of using this bundle?
- Code risk is low because the codebase is small and legible, but ecosystem risk is moderate to high. It has a single maintainer, a tiny star count, no known dependents, and low activity, so treat it as low-activity rather than actively maintained. Release hygiene is also a concern because the 7.1 notes are a one-line thank-you with no changelog or migration note, so diff the config tree class between your pinned version and 7.1 before upgrading.
- Can I put role-based access control in YAML menu extras?
- You should avoid treating menu visibility as authorization. Menu definitions often encode authorization intent, and moving them into YAML can make security logic look like ordinary configuration. Nested extras make conventions such as extras.roles easy to invent and easy to mistake for enforcement. Keep access control in security voters, controllers, or PHP menu builders, and use menus only for presentation.
- What changed in version 7.1 of config-knp-menu-bundle?
- Version 7.1 adds nested extras, allowing menu items to carry arbitrarily nested metadata structures in YAML instead of flat key/value pairs. This helps menus that previously needed PHP only for rich per-item presentation metadata such as icon sets, nested badge configuration, dropdown grouping attributes, or structured route parameters. It does not enable runtime data-driven menus, because extras are static configuration-time data. Assume no config schema stability guarantee and diff the config tree class before adopting it.
- What are alternatives to configuration-driven KnpMenu menus?
- The main alternative is native KnpMenuBundle with PHP MenuBuilder classes, which remains the right choice for dynamic or permission-filtered menus. You can also build a custom menu provider or use another Symfony menu bundle. For Laravel applications, use Laravel-specific menu packages or custom PHP menu builders instead. This bundle is a thin declarative layer that complements KnpMenu rather than replacing it.