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

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

gourmet/knp-menu
================

KnpMenu for CakePHP 3

v0.5.0(10y ago)1450.7k↑44.4%3[4 issues](https://github.com/gourmet/knp-menu/issues)[1 PRs](https://github.com/gourmet/knp-menu/pulls)3MITPHP

Since Sep 25Pushed 8y ago4 watchersCompare

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

READMEChangelogDependencies (3)Versions (9)Used By (3)

KnpMenu
=======

[](#knpmenu)

[![Build Status](https://camo.githubusercontent.com/4bab7f4d6856f08d67666706b23c7165bf7190f7345dbe767826253cdc2d993e/68747470733a2f2f7472617669732d63692e6f72672f676f75726d65742f6b6e702d6d656e752e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gourmet/knp-menu)[![Total Downloads](https://camo.githubusercontent.com/af42822f6fb029e5c66403ca670841d5e6e3e0e9fa95068a3a94b202615f5de4/68747470733a2f2f706f7365722e707567782e6f72672f676f75726d65742f6b6e702d6d656e752f646f776e6c6f6164732e737667)](https://packagist.org/packages/gourmet/knp-menu)[![License](https://camo.githubusercontent.com/da6e8db8420493f771c196e1c0155fb02efa49d4c7da69a42883b77d4cdedd36/68747470733a2f2f706f7365722e707567782e6f72672f676f75726d65742f6b6e702d6d656e752f6c6963656e73652e737667)](https://packagist.org/packages/gourmet/knp-menu)

Use [KnpMenu](https://github.com/KnpLabs/KnpMenu) with [CakePHP 3](http://cakephp.org).

What's included?
----------------

[](#whats-included)

- MenuComponent
- MenuHelper

Install
-------

[](#install)

Using [Composer](http://getcomposer.org):

```
composer require gourmet/knp-menu:~0.4

```

You then need to load the plugin. In `boostrap.php`, something like:

```
\Cake\Core\Plugin::load('Gourmet/KnpMenu');
```

and add the following to your `App\Controller\AppController`:

```
public $components = ['Gourmet/KnpMenu.Menu'];
public $helpers = ['Gourmet/KnpMenu.Menu'];
```

Usage
-----

[](#usage)

It's fairly simple. The concept is you `get` a menu, and you `addChild` to it from anywhere at anytime at the controller or view layer. At the view layer, you can also render any defined menu.

### Get a menu

[](#get-a-menu)

```
$menu = $this->Menu->get('my_menu');
```

### Add child to menu

[](#add-child-to-menu)

```
// using an array for URL and child's name as title
$menu->addChild('Dashboard', ['uri' => ['controller' => 'Users', 'action' => 'dashboard']]);
// using a named route for URL and custom title
$menu->addChild('Dashboard', ['route' => 'dashboard', 'label' => 'My Account']);
```

### Render a menu

[](#render-a-menu)

*Only available at the view layer*

```
// by default, renders as a list
echo $this->Menu->render('my_menu');
```

Of course, you can set your own renderer (defaults to `\Gourmet\KnpMenu\Menu\Renderer\ListRenderer`) and matcher (defaults to `\Gourmet\KnpMenu\Menu\Matcher\Matcher`) by passing them as options:

```
echo $this->Menu->render('my_menu', [
    'matcher' => '\Custom\Matcher',
    'renderer' => new \Custom\Renderer(...)
]);
```

For more, please check the official [KnpMenu](https://github.com/KnpLabs/KnpMenu) repo and documentation.

Patches &amp; Features
----------------------

[](#patches--features)

- Fork
- Mod, fix
- Test - this is important, so it's not unintentionally broken
- Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
- Pull request - bonus point for topic branches

Bugs &amp; Feedback
-------------------

[](#bugs--feedback)

License
-------

[](#license)

Copyright (c) 2015, Jad Bitar and licensed under [The MIT License](http://www.opensource.org/licenses/mit-license.php).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.8% 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 ~60 days

Recently: every ~75 days

Total

6

Last Release

3954d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ccb57ae849b67ade8d9c1e266bc2868183bbcf07fb6c66c2d45254a452272d54?d=identicon)[jadb](/maintainers/jadb)

---

Top Contributors

[![jadb](https://avatars.githubusercontent.com/u/33527?v=4)](https://github.com/jadb "jadb (33 commits)")[![GuidoHendriks](https://avatars.githubusercontent.com/u/5393965?v=4)](https://github.com/GuidoHendriks "GuidoHendriks (4 commits)")[![adamharley](https://avatars.githubusercontent.com/u/863768?v=4)](https://github.com/adamharley "adamharley (1 commits)")

---

Tags

knpcakephpmenu

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[knplabs/knp-menu-bundle

This bundle provides an integration of the KnpMenu library

1.4k53.8M315](/packages/knplabs-knp-menu-bundle)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[icings/menu

A KnpMenu seasoned menu plugin for CakePHP.

1266.4k1](/packages/icings-menu)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)

PHPackages © 2026

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