PHPackages                             jbouzekri/config-knp-menu-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jbouzekri/config-knp-menu-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

jbouzekri/config-knp-menu-bundle
================================

Configure your knp menus with yaml files accross your project bundles

7.1(3y ago)659.6k↓44.1%11MITPHPPHP &gt;=7.4

Since May 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jbouzekri/ConfigKnpMenuBundle)[ Packagist](https://packagist.org/packages/jbouzekri/config-knp-menu-bundle)[ Docs](https://github.com/jbouzekri/ConfigKnpMenuBundle)[ RSS](/packages/jbouzekri-config-knp-menu-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (0)

ConfigKnpMenuBundle
===================

[](#configknpmenubundle)

[![Build Status](https://camo.githubusercontent.com/b0a33cca13612978da6bc2a85919f6c3054d4ee09238c322798d93b0b384448f/68747470733a2f2f7472617669732d63692e6f72672f6a626f757a656b72692f436f6e6669674b6e704d656e7542756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jbouzekri/ConfigKnpMenuBundle)[![SensioLabsInsight](https://camo.githubusercontent.com/8608fa9e16ea7ce51a38652780c7f4c852de62e9245d41b8dbe2e6291f3fa13d/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30626133653265362d346239312d343838362d616138642d3436323065623234333834352f6d696e692e706e67)](https://insight.sensiolabs.com/projects/0ba3e2e6-4b91-4886-aa8d-4620eb243845)

Introduction
------------

[](#introduction)

This bundle provides a way to configure your knp menus in your bundles yml configuration.

For more information on knp menu, read :

- The [Knp Menu Documentation](https://github.com/KnpLabs/KnpMenu/blob/master/README.markdown)
- The [Knp Menu Bundle Documentation](https://github.com/KnpLabs/KnpMenuBundle/blob/master/README.md)

This bundle was inspired by the [OroNavigationBundle](https://github.com/orocrm/platform/tree/master/src/Oro/Bundle/NavigationBundle) in oro crm.

Installation
------------

[](#installation)

You can use composer for installation.

Add the repository to the composer.json file of your project and run the update or install command.

```
{
    "require": {
        "jbouzekri/config-knp-menu-bundle": "3.0.0"
    }
}
```

Then enable it in your AppKernel.php with the KnpMenuBundle :

```
$bundles = array(
    ...
    new Knp\Bundle\MenuBundle\KnpMenuBundle(),
    new Jb\Bundle\ConfigKnpMenuBundle\JbConfigKnpMenuBundle(),
);
```

Documentation
-------------

[](#documentation)

In order to use this bundle, you must define your menu configuration in a **navigation.yml** file in your bundle.

Example :

```
my_mega_menu:
    tree:
        first_level_item:
            label: My first label
            children:
                second_level_item:
                    label: My second level
```

It will configure a provider for knp menu factory. You can then use your my\_mega\_menu in twig as a classic knp menu :

```
{{ knp_menu_render('my_mega_menu') }}
```

Configuration
-------------

[](#configuration)

This is the available configuration definition for an item.

```
my_mega_menu:
    childrenAttributes: An array of attributes passed to the root ul tag
    tree:
        first_level_item:
            uri: "An uri. Use it if you do not define route parameter"
            route: "A sf2 route without @"
            routeParameters: "an array of parameters to pass to the route"
            label: "My first label"
            order: An integer to sort the item in his level.
            attributes: An array of attributes passed to the knp item
            linkAttributes: An array of attributes passed to the a tag
            childrenAttributes: An array of attributes passed to the chidlren block
            labelAttributes: An array of attributes passed to the label tag
            display: boolean to hide the item
            displayChildren: boolean to hide the children
            roles: array of item (string roles) passed to isGranted securityContext method to check if user has rights in menu items
            extras: An array of extra parameters (for example icon img, additional content etc.)
            children: # An array of subitems
                second_level_item:
                    label: My second level
```

This configuration matches the methods available in the Knp Menu Item class

Menu security
-------------

[](#menu-security)

Security context is injected in menu item provider.

For root menu item, display or hide it in your twig template. For children items, if you didn't add the roles key, they will be displayed. Else it will passed the array of key to the isGranted method and check if you have rights on the the item.

Issues
------

[](#issues)

- tree sub configuration property : In the navigation.yml file, you must defined a tree key below your menu name. It provides another level to keep the first level item key after configuration parsing. If someone know how to remove it, let me know.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 82.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~247 days

Recently: every ~334 days

Total

14

Last Release

1173d ago

Major Versions

2.0.0 → 3.0.02014-10-24

3.0.0 → 4.0.02015-12-30

4.2 → 5.02019-12-16

5.0 → 6.02020-11-24

6.0 → 7.02022-05-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/18963e247548b59e56dae09599281b9c34e70113fc384a42925411d9b9307fd5?d=identicon)[jbouzekri](/maintainers/jbouzekri)

---

Top Contributors

[![jbouzekri](https://avatars.githubusercontent.com/u/880996?v=4)](https://github.com/jbouzekri "jbouzekri (71 commits)")[![munkie](https://avatars.githubusercontent.com/u/102297?v=4)](https://github.com/munkie "munkie (11 commits)")[![Baachi](https://avatars.githubusercontent.com/u/833645?v=4)](https://github.com/Baachi "Baachi (2 commits)")[![bartlomiej-kwiatek-vml](https://avatars.githubusercontent.com/u/149397481?v=4)](https://github.com/bartlomiej-kwiatek-vml "bartlomiej-kwiatek-vml (1 commits)")[![netfarma](https://avatars.githubusercontent.com/u/1618812?v=4)](https://github.com/netfarma "netfarma (1 commits)")

---

Tags

symfonyknpuimenunavigationuser-interface

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jbouzekri-config-knp-menu-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/jbouzekri-config-knp-menu-bundle/health.svg)](https://phpackages.com/packages/jbouzekri-config-knp-menu-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[swiegmann/kirby-menu

This Kirby CMS-Plugin lets you build and render structured menues with a variety of features.

141.4k](/packages/swiegmann-kirby-menu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
