PHPackages                             aberkow/a11y-menu-php - 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. aberkow/a11y-menu-php

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

aberkow/a11y-menu-php
=====================

A package for generating accessible navigation menus

08[16 PRs](https://github.com/aberkow/a11y-menu-php/pulls)PHP

Since Apr 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aberkow/a11y-menu-php)[ Packagist](https://packagist.org/packages/aberkow/a11y-menu-php)[ RSS](/packages/aberkow-a11y-menu-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (18)Used By (0)

A11Y Menu PHP Version
=====================

[](#a11y-menu-php-version)

This package is a PHP version of the npm a11y-menu markup generation utilities.

The goal is to provide a developer experience similar to the a11y-menu javascript package. That includes:

- Generating menus from JSON
- Providing access to the minimal styles and script from the a11y-menu package
- Allowing developers a straightforward menu generation experience. The class exposes a single static method.

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

[](#installation)

This package should be installed with composer - `composer require aberkow/a11y-menu-php`.

Requirements
------------

[](#requirements)

Using the markup generator requires a JSON file with the following format.

```
{
  "menu": [
    {
      "name": "Display Name",
      "slug": "slugified-name",
      "link": "/route",
      "sub": false,
      "classes": ["optional", "classes"]
    }
  ]
}
```

if a submenu is required, mark the `sub` property as `true` and provide a `menu` property with an array of menu items. For example

```
{
  "menu": [
    {
      "name": "Display Name",
      "slug": "slugified-name",
      "link": "/route",
      "sub": true,
      "classes": ["optional", "classes"],
      "menu": [
        {
          "name": "Submenu Item 1",
          "slug": "submenu-item-1",
          "link": "/submenu-item-1",
          "sub": false
        },
        {
          "name": "Submenu Item 2",
          "slug": "submenu-item-2",
          "link": "/submenu-item-2",
          "sub": false
        }
      ]
    }
  ]
}
```

Use
---

[](#use)

Using the menu generator is straightforward. It requires

- the base stylesheet
- the base Navigation script
- using the generator's `display_menu` method

### Steps

[](#steps)

- require `vendor/autoload.php`
- create a json file as above and decode it

```
$data = file_get_contents('path/to/file.json');
$menu = json_decode($data)->menu;
```

- create navigation markup
    - prefix nav and ul ids with `am-`

```

```

- echo the results of the menu generator inside the ``
- add styles and the `Navigation.js` script

```

// before the closing body tag...

```

### More...

[](#more)

For more details on styling and js implementation, [please see the `a11y-menu` github repo](https://github.com/aberkow/a11y-menu). This repo has information about

- The `Navigation` javascript constructor
- Incorporating alternative menu icons
- Extending the base styles

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7248a69d9692bf03eba3f8420de1188cbaecafa1f72caa5581fc8bd9c3c7079d?d=identicon)[aberkow](/maintainers/aberkow)

---

Top Contributors

[![aberkow](https://avatars.githubusercontent.com/u/4681584?v=4)](https://github.com/aberkow "aberkow (1 commits)")

### Embed Badge

![Health badge](/badges/aberkow-a11y-menu-php/health.svg)

```
[![Health](https://phpackages.com/badges/aberkow-a11y-menu-php/health.svg)](https://phpackages.com/packages/aberkow-a11y-menu-php)
```

PHPackages © 2026

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