PHPackages                             symkit/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. symkit/menu-bundle

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

symkit/menu-bundle
==================

Menu Bundle for Symkit

v0.0.3(2mo ago)02894MITPHPPHP &gt;=8.2CI passing

Since Feb 22Pushed 2mo agoCompare

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

READMEChangelogDependencies (17)Versions (4)Used By (4)

Symkit Menu Bundle
==================

[](#symkit-menu-bundle)

[![CI](https://github.com/symkit/menu-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/symkit/menu-bundle/actions)[![Latest Version](https://camo.githubusercontent.com/9787a26d66050362c83dbd230ec5bf0ae1190300716c0b0d3c238ec9986d43f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796d6b69742f6d656e752d62756e646c652e737667)](https://packagist.org/packages/symkit/menu-bundle)[![PHPStan Level 9](https://camo.githubusercontent.com/1bc07920f0d36e55c17e1d38b1caa132cc605f51a82b388c962870b9a747b898/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e737667)](https://phpstan.org/)

A flexible, **SOLID** menu system for Symfony. Manage menus from the database or via PHP builders, with support for complex structures (Mega Menus, advanced dropdowns).

Features
--------

[](#features)

- **Database or code**: Menus from Doctrine entities (priority) or from tagged builders.
- **Configurable**: Enable/disable admin, Twig, AssetMapper, Doctrine independently.
- **Overridable entities**: Configure custom `Menu` / `MenuItem` FQCNs.
- **Routes in config**: Admin routes loaded from a routing file with configurable prefix.
- **Public API**: Type-hint on `Symkit\MenuBundle\Contract\*` interfaces for BC-safe usage.

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

[](#installation)

```
composer require symkit/menu-bundle
```

Register the bundle in `config/bundles.php` (auto with Flex):

```
return [
    Symkit\MenuBundle\SymkitMenuBundle::class => ['all' => true],
];
```

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

[](#configuration)

All features are enabled by default. Example with explicit options:

```
# config/packages/symkit_menu.yaml
symkit_menu:
    admin:
        enabled: true
        route_prefix: admin   # prefix for admin routes (default: admin)
    twig:
        enabled: true
    assets:
        enabled: true        # AssetMapper prepend for Stimulus controllers
    doctrine:
        enabled: true
        entities:
            menu: Symkit\MenuBundle\Entity\Menu
            menu_item: Symkit\MenuBundle\Entity\MenuItem
```

### Routes

[](#routes)

Include the bundle admin routes in your app (e.g. `config/routes.yaml`):

```
symkit_menu:
    resource: '@SymkitMenuBundle/Resources/config/routing.yaml'
    prefix: '%symkit_menu.admin.route_prefix%'
```

This registers routes such as `admin_menu_list`, `admin_menu_create`, `admin_menu_edit`, `admin_menu_item_*`, `admin_menu_items_json`. Change `route_prefix` in config to alter the URL prefix (e.g. `/back-office/menus`).

### Overriding entities

[](#overriding-entities)

To use your own `Menu` or `MenuItem` classes (e.g. extended with extra fields):

1. Extend the bundle entities: `class App\Entity\Menu extends Symkit\MenuBundle\Entity\Menu`.
2. Configure the FQCNs:

```
symkit_menu:
    doctrine:
        entities:
            menu: App\Entity\Menu
            menu_item: App\Entity\MenuItem
```

3. Map your entities in Doctrine (XML/attributes) as usual.

Usage
-----

[](#usage)

### Admin UI

[](#admin-ui)

With `admin.enabled: true` and [symkit/crud-bundle](https://github.com/symkit/crud-bundle) and [symkit/metadata-bundle](https://github.com/SymKit/metadata-bundle) installed, you get CRUD for menus and items (hierarchy, types, icons). Admin controllers use `#[Seo]` and `#[Breadcrumb]` from the metadata bundle when available.

### PHP builders

[](#php-builders)

Implement the **Contract** interface and tag the service:

```
namespace App\Navigation;

use Symkit\MenuBundle\Contract\MenuNavigationBuilderInterface;
use Symkit\MenuBundle\Contract\MenuItemInterface;
use Symkit\MenuBundle\Model\MenuLink;

class PrimaryNavigationBuilder implements MenuNavigationBuilderInterface
{
    public function build(): array
    {
        return [
            new MenuLink('home', 'Home', '/'),
            // ...
        ];
    }
}
```

```
services:
    App\Navigation\PrimaryNavigationBuilder:
        tags:
            - { name: 'symkit_menu.menu_builder', alias: 'primary' }
```

### Active menu

[](#active-menu)

Use the `#[ActiveMenu]` attribute on controllers:

```
use Symkit\MenuBundle\Attribute\ActiveMenu;

#[ActiveMenu('primary', 'home')]
public function index(): Response { ... }
```

Or set it manually:

```
$menuManager->setActiveId('primary', 'item_id');
```

### Twig

[](#twig)

When `twig.enabled: true`, use the `get_menu` function:

```
{% for item in get_menu('primary') %}
    {{ include('@SymkitMenu/components/menu/_' ~ (item.type == 'mega' ? 'mega_menu_full' : (item.type == 'advanced_dropdown' ? 'dropdown_advanced' : (item.type == 'dropdown' ? 'dropdown_simple' : 'link'))) ~ '.html.twig', {item: item}) }}
{% endfor %}
```

Public API (Contract)
---------------------

[](#public-api-contract)

For stable, BC-safe integration, type-hint on interfaces under `Symkit\MenuBundle\Contract\`:

- **MenuNavigationBuilderInterface**: implement `build(): array` (of `MenuItemInterface`).
- **MenuItemMapperInterface**: implement `supports(MenuItem $entity): bool` and `map(MenuItem $entity, MenuModelFactory $factory): MenuItemInterface`.
- **MenuItemInterface**: id, label, active state, type.

Models under `Symkit\MenuBundle\Model\` (e.g. `MenuLink`, `MenuDropdown`) implement these contracts.

Customization
-------------

[](#customization)

1. Create a model implementing `Symkit\MenuBundle\Contract\MenuItemInterface`.
2. Create a mapper implementing `Symkit\MenuBundle\Contract\MenuItemMapperInterface`.
3. Tag the mapper with `symkit_menu.menu_item_mapper`.

The bundle will use your mapper when it meets the corresponding entity type.

Stimulus / AssetMapper
----------------------

[](#stimulus--assetmapper)

With `assets.enabled: true`, the bundle prepends its Stimulus controllers to AssetMapper. Register them in your app (e.g. `importmap.php` and `stimulus_bootstrap.js`) as needed for dropdown and mobile menu behaviour.

Contributing
------------

[](#contributing)

```
make install
make cs-fix
make phpstan
make test
make quality         # cs-check + phpstan + deptrac + lint + test + infection
make ci              # security-check + quality
```

License
-------

[](#license)

MIT.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance83

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

85d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/077eba6702dc23a795ee2262dff92505e3c8ead08f7cb205be80d8aae0a6b8e5?d=identicon)[sdieunidou](/maintainers/sdieunidou)

---

Top Contributors

[![sdieunidou](https://avatars.githubusercontent.com/u/570763?v=4)](https://github.com/sdieunidou "sdieunidou (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/symkit-menu-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[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)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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