PHPackages                             richardhj/contao-knp-menu - 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. richardhj/contao-knp-menu

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

richardhj/contao-knp-menu
=========================

Wrapper extension for knp-menu.

1.3.3(8mo ago)617.0k—2.3%4MITPHPPHP &gt;=7.4

Since Aug 17Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/richardhj/contao-knp-menu)[ Packagist](https://packagist.org/packages/richardhj/contao-knp-menu)[ RSS](/packages/richardhj-contao-knp-menu/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (23)Used By (0)

Contao KnpMenu
==============

[](#contao-knpmenu)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ee965f11425ec782848a424e0c43f321b13d04b92d2b00b4913635259f2c0afc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696368617264686a2f636f6e74616f2d6b6e702d6d656e752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/richardhj/contao-knp-menu)

Provides Contao navigation modules as instances of [KnpMenu](https://github.com/KnpLabs/KnpMenuBundle).

This extension is stable and supported from Contao &gt;=4.9 and will be integrated into the Contao Core at some time, see [contao/contao#3838](https://github.com/contao/contao/pull/3838).

Install
-------

[](#install)

Via Composer

```
$ composer require richardhj/contao-knp-menu
```

Usage
-----

[](#usage)

### Retrieve a navigation module by its alias

[](#retrieve-a-navigation-module-by-its-alias)

For any navigation module in the Contao backend, you can define an alias. You can now retrieve this navigation by its alias:

```
{% set menu = knp_menu_get('main_navigation') %}
```

You can also override some settings in the navigation module:

```
{% set menu = knp_menu_get('main_navigation', [], { 'showHidden': true, 'showProtected': true }) %}
```

### Use a default navigation

[](#use-a-default-navigation)

You don't necessarily need to create a navigation module. Just use the special key `'contao'` and configure it with the third parameter where necessary.

```
{% set menu = knp_menu_get('contao', [], { 'defineRoot': 1 }) %}
```

### Render a menu within a twig template

[](#render-a-menu-within-a-twig-template)

This extension was created to have maximum flexibility in rendering the navigation, thus the extension does not provide a base template. This is an example of retrieving and parsing a simple navigation within a twig template.

```

    {% set menu = knp_menu_get('main_navigation') %}

        {% block navigation %}
            {% import '@KnpMenu/menu.html.twig' as knp_menu %}

                {% for item in menu.children|filter(v => v.isDisplayed) %}
                    {% if item.current %}

                            {{ item.label }}

                    {% else %}

                            {{ item.label }}

                    {% endif %}
                {% endfor %}

        {% endblock %}

```

Development notes:
------------------

[](#development-notes)

Code style:

```
vendor/bin/ecs check --fix
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance60

Regular maintenance activity

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 65.9% 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 ~88 days

Recently: every ~164 days

Total

22

Last Release

253d ago

Major Versions

0.1.7 → 1.0.02021-02-02

PHP version history (3 changes)0.1.0PHP ^7.4

1.0.1PHP ^7.4 || ^8.0

1.1.1PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1284725?v=4)[Richard Henkenjohann](/maintainers/richardhj)[@richardhj](https://github.com/richardhj)

---

Top Contributors

[![richardhj](https://avatars.githubusercontent.com/u/1284725?v=4)](https://github.com/richardhj "richardhj (27 commits)")[![m-vo](https://avatars.githubusercontent.com/u/5305677?v=4)](https://github.com/m-vo "m-vo (7 commits)")[![koertho](https://avatars.githubusercontent.com/u/12064642?v=4)](https://github.com/koertho "koertho (6 commits)")[![bytehead](https://avatars.githubusercontent.com/u/754921?v=4)](https://github.com/bytehead "bytehead (1 commits)")

### Embed Badge

![Health badge](/badges/richardhj-contao-knp-menu/health.svg)

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

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.5k](/packages/numero2-contao-storelocator)

PHPackages © 2026

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