PHPackages                             waynestate/parse-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. waynestate/parse-menu

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

waynestate/parse-menu
=====================

Parse menus from the Wayne State University API

1.2.2(9y ago)034.8k↓29.8%MITPHPPHP &gt;=5.3.0

Since Sep 12Pushed 9y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (13)Used By (0)

ParseMenu Class
===============

[](#parsemenu-class)

Parse menus from the Wayne State University API

[![Latest Stable Version](https://camo.githubusercontent.com/193727818617972f376d300cfe156433e29953a49e4835f526de75b76060e404/68747470733a2f2f706f7365722e707567782e6f72672f7761796e6573746174652f70617273652d6d656e752f762f737461626c652e737667)](https://packagist.org/packages/waynestate/parse-menu)[![Build Status](https://camo.githubusercontent.com/5da9643b9cd1af5f1bfc4232827456cbff0b0a6b9509a0f1b972ef134db5086b/68747470733a2f2f7472617669732d63692e6f72672f7761796e6573746174652f70617273652d6d656e752e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/waynestate/parse-menu)[![Total Downloads](https://camo.githubusercontent.com/5c09f7ca643f979f1d2f8ef5f9afa5dc03df7459d2d83a1d9725d47254044fbd/68747470733a2f2f706f7365722e707567782e6f72672f7761796e6573746174652f70617273652d6d656e752f646f776e6c6f6164732e737667)](https://packagist.org/packages/waynestate/parse-menu)[![License](https://camo.githubusercontent.com/9e3d37f45a3b5e14b93ec57805b0f0572ccf653d5aa5c10a619a0e307f4f4755/68747470733a2f2f706f7365722e707567782e6f72672f7761796e6573746174652f70617273652d6d656e752f6c6963656e73652e737667)](https://packagist.org/packages/waynestate/parse-menu)

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

[](#installation)

To install this library, run the command below and you will get the latest version

```
composer require waynestate/parse-menu

```

Usage
-----

[](#usage)

Create the object

```
# start.php

use Waynestate\Menuitems\ParseMenu;

...

$parseMenu = new ParseMenu;

```

Make an API call for the menu

```
# controller.php

try {
    // Pull a specific menu from the API for a site
    $params = array(
        'site_id' => 1,
        'menu_id' => 2,
        'ttl' => TTL,
    );
    $menus = $api->sendRequest('cms.menuitems.listing', $params);

    // Menu config
    $menu_config = array(
        'page_selected' => 1,
    );

    // Get a final array to display the main menu
    $main_menu = $parseMenu->parse($menus[2], $menu_config);

    // Get the breadcrumbs from the parsed menu $main_menu
    $breadcrumbs = array();
    if(count($site_menu['meta']['path']) > 0) {
        $breadcrumbs = $parseMenu->getBreadCrumbs($main_menu);

        // Add the site root crumb
        $root_crumb = [
            'display_name' => 'Home',
            'relative_url' => '/',
        ];
        $breadcrumbs = $parseMenu->prependBreadCrumb($breadcrumbs, $root_crumb);
    }

    // Just display the first level in the header
    $top_menu_config = array(
        'display_levels' => 1,
    );

    // Parse the existing menu with the specific top_menu config
    $top_menu = $parseMenu->parse($main_menu, $top_menu_config);

} catch (Exception $e) {

    echo 'Caught exception: '.  $e->getMessage(). "\n";
}

```

Return values

```
$main_menu['meta'] = [
    'has_selected' => boolean, // default: false
    'has_submenu' => boolean, // default: false
    'depth' => integer, // default: 0
    'path' => array, // default: array()
]

$main_menu['menu'] = [
    // Array of the menu
]

$breadcrumbs = [
    // Sequential array of individual breadcrumbs in order based on the $main_menu['meta']['path']
]

```

Config Options

```
'page_selected' = Page ID for selection path (optional)
'skip_levels' = Number of levels to skip from the root (requires page_selected)
'display_levels' = Number of levels to display from the root (requires page_selected, if > 1)
'full_menu' = Return the full menu regardless if there is a page selected (boolean, default: false)
TODO: 'show_levels' = Number of levels to display from the leaf (requires page_selected)
TODO: 'add_home' = Add 'Home' as the first menu item (this may not be needed)

```

Exceptions

```
InvalidDisplayLevelsException = If 'display_levels' > 1 and no 'page_selected' found

```

Tests

```
phpunit

```

Code Coverage

```
phpunit --coverage-html ./coverage

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 72.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 ~78 days

Recently: every ~64 days

Total

11

Last Release

3482d ago

Major Versions

0.2.1 → 1.0.02016-02-19

### Community

Maintainers

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

---

Top Contributors

[![nickdenardis](https://avatars.githubusercontent.com/u/37359?v=4)](https://github.com/nickdenardis "nickdenardis (66 commits)")[![chrispelzer](https://avatars.githubusercontent.com/u/636531?v=4)](https://github.com/chrispelzer "chrispelzer (25 commits)")

---

Tags

arrayparser

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waynestate-parse-menu/health.svg)

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

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)

PHPackages © 2026

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