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
Knp Menu Bundle

Knp Menu Bundle Laravel Package

knplabs/knp-menu-bundle

KnpMenuBundle integrates the KnpMenu PHP library with Symfony, making it easy to build feature-rich, flexible menus in your Symfony applications with minimal configuration.

View on GitHub
Deep Wiki
Context7

This bundle provides an integration of the KnpMenu library

Frequently asked questions about Knp Menu Bundle
Can I use knplabs/knp-menu-bundle in a Laravel application?
No. KnpMenuBundle is a Symfony bundle built on Symfony's DI container, event dispatcher, and Twig bridge, so it cannot be dropped into Laravel. For Laravel, evaluate the framework-agnostic knplabs/knp-menu core library and write a Blade renderer if needed. Anything the bundle adds beyond the core menu tree API must be rebuilt.
What is KnpMenuBundle used for?
It integrates the KnpMenu PHP library with Symfony to build object-oriented, feature-rich menus. It handles Symfony service wiring, Twig rendering, and Symfony-specific menu events and voters. The underlying KnpMenu library provides the menu tree, renderers, and matchers independently of Symfony.
How do I install KnpMenuBundle?
In a Symfony app, install it with Composer using composer require knplabs/knp-menu-bundle and enable the bundle in Symfony's bundle configuration. You then configure menus as services and render them in Twig. In Laravel, install only knplabs/knp-menu if you want the core menu tree.
Does KnpMenuBundle support Laravel 10 or Laravel 11?
There is no Laravel support in KnpMenuBundle; it targets Symfony, not Laravel 10 or 11. Laravel version support is therefore not applicable to the bundle. Laravel teams should assess the standalone KnpMenu core and its PHP requirements separately.
What PHP version does KnpMenuBundle 3.8 require?
Version 3.8.0 dropped PHP 8.1 and requires PHP 8.2 or newer, with CI tested on PHP 8.5. That can block Laravel 10 estates still running PHP 8.1. Verify your runtime matrix and the exact composer.json constraints before planning an upgrade.
Can I render KnpMenu menus with Blade instead of Twig?
Not with KnpMenuBundle directly. Version 3.8.0 removed the deprecated PHP templating integration, so the bundle's rendering path is Twig-only. For Blade, use the standalone knplabs/knp-menu library and implement a custom Blade renderer over the menu tree.
How do I configure active menu items or disable RouteVoter in KnpMenuBundle?
Version 3.8.0 adds a configuration toggle to disable the default RouteVoter, which previously required overriding or decorating the voter in code for non-standard routing. This reduces bespoke code for Symfony teams with localised routes, mounted sub-apps, or custom URL resolution. Laravel's router is a different abstraction, so this Symfony voter does not carry over.
Is KnpMenuBundle maintained and safe for production?
The maintenance signal is positive: active CI on PHP 8.5, coding-standard fixes, first-time contributors, and deliberate legacy pruning. However, it is maintained by volunteers with no commercial SLA, so it is acceptable for non-critical navigation but questionable for revenue-path surfaces without an internal fallback. Pin Composer constraints tightly because 3.8.0 shipped breaking changes in a minor release.
What are alternatives to KnpMenuBundle for Laravel menus?
For Laravel, the closest reusable option is the standalone knplabs/knp-menu core library plus a custom Blade renderer. Laravel-native menu packages may be simpler if you do not need KnpMenu's tree, matcher, and renderer model. The Symfony bundle itself is not an alternative for Laravel.
How do I test menus built with KnpMenu in Laravel?
Test the standalone KnpMenu tree construction and matchers with PHPUnit independently of Laravel's HTTP layer. Then test your custom Blade renderer with Laravel's view or feature tests. The Symfony bundle's integration tests are not reusable for Laravel because they depend on Symfony services and Twig.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo