PHPackages                             bw/active-menu-item-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. bw/active-menu-item-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bw/active-menu-item-bundle
==========================

The active menu item highlighting of simple HTML menu in Symfony applications

v1.2.0(2y ago)446.7k↓33.3%5[1 issues](https://github.com/bocharsky-bw/ActiveMenuItemBundle/issues)MITPHPPHP &gt;=5.5.9

Since May 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bocharsky-bw/ActiveMenuItemBundle)[ Packagist](https://packagist.org/packages/bw/active-menu-item-bundle)[ Docs](https://github.com/bocharsky-bw/ActiveMenuItemBundle)[ RSS](/packages/bw-active-menu-item-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (11)Used By (0)

ActiveMenuItemBundle
====================

[](#activemenuitembundle)

The bundle provides a few simple Twig filters and functions that help to highlight current active menu items of simple HTML menu in Twig templates by adding specific CSS classes.

How to Install
--------------

[](#how-to-install)

Install the bundle with `Composer`:

```
composer require bw/active-menu-item-bundle
```

Then, to use filters and functions in Twig, register this bundle in `bundles.php`:

```
// config/bundles.php

return [
    // other bundles...
    BW\ActiveMenuItemBundle\BWActiveMenuItemBundle::class => ['all' => true],
};
```

But if you use Symfony Flex - it was already done automatically for you :)

How to Use
----------

[](#how-to-use)

To check whether the menu item route is active, simply use `is_active` Twig filter:

```
{{ 'route_name'|is_active }}
```

Or use `is_active_uri` Twig filter for check if menu item's request URI is active:

```
{{ path('route_name')|is_active_uri }}
```

If the route or the request URI is matched, filters return `current active` string that you will need to use in `class` attribute of the menu item tag. Then, all you need to do is add your custom CSS rules for those classes in your stylesheets.

### How to Use with Multi-level Nested Menu

[](#how-to-use-with-multi-level-nested-menu)

To check an array of possible routes use `is_active()` Twig function where pass an array of routes (all submenu item route names of the current item) as the first argument and the current item route name as the second one.

For example, there is a simple HTML menu with nested submenu:

```

        All categories

                Subcategory 1

                Subcategory 2

```

If the current route is `subcategory1_route_name`, it will have `current active` class and its parent item - `all_categories_route_name` route - will have only `active` class.

And same for request URIs with `is_active_uri()` Twig function, but instead of passing an array of routes, pass an array of URIs.

Demo
----

[](#demo)

This bundle has a demo page with an example of simple multi-level HTML menu. Create the next file to see the demo in `dev` Symfony mode:

```
# config/routes/dev/bw_active_menu_item.yaml

bw_active_menu_item:
    resource: "@BWActiveMenuItemBundle/Resources/config/routing.yml"
    prefix:   /bw/demo/active-menu-item
```

Then, run Symfony's built-in web server with `symfony serve` and go to: .

Under the Hood
--------------

[](#under-the-hood)

There are only [a few](https://github.com/bocharsky-bw/ActiveMenuItemBundle/blob/master/src/Twig/BWExtension.php) simple Twig filters and functions, that's it!

*Simple, isn't it? :)*

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 73.5% 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 ~391 days

Recently: every ~878 days

Total

10

Last Release

852d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

v1.1.5PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce9dde2c8d3d5fcfdbb5427f981df17123b54b410e21e4dfc933f07983eefeba?d=identicon)[bocharsky-bw](/maintainers/bocharsky-bw)

---

Top Contributors

[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (25 commits)")[![BeyerJC](https://avatars.githubusercontent.com/u/34127121?v=4)](https://github.com/BeyerJC "BeyerJC (7 commits)")[![Raistlfiren](https://avatars.githubusercontent.com/u/234712?v=4)](https://github.com/Raistlfiren "Raistlfiren (2 commits)")

---

Tags

highlightmenuactiveitembw

### Embed Badge

![Health badge](/badges/bw-active-menu-item-bundle/health.svg)

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

###  Alternatives

[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[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)[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)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)[pixelopen/cloudflare-turnstile-bundle

A simple package to help integrate Cloudflare Turnstile on Symfony.

31205.8k3](/packages/pixelopen-cloudflare-turnstile-bundle)

PHPackages © 2026

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