PHPackages                             wwaz/favigation-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. wwaz/favigation-php

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

wwaz/favigation-php
===================

Renders recursive navigation data

v1.1.1(2mo ago)042MITPHPPHP ^8.1CI passing

Since Feb 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/WWAZ/favigation-php)[ Packagist](https://packagist.org/packages/wwaz/favigation-php)[ RSS](/packages/wwaz-favigation-php/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Favigation PHP
==============

[](#favigation-php)

**Favigation** turns any navigation data into clean HTML markup — without wrestling with recursion, nested loops, or edge cases.

```
composer require wwaz/favigation-php
```

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

[](#requirements)

- PHP `^8.1`
- Composer 2
- Illuminate Support `^10|^11|^12` (works great in Laravel projects, but can also be used standalone)

---

What it does
------------

[](#what-it-does)

You give Favigation a flat list of menu items. It automatically builds a correctly nested `` structure — including sorting, active state, and fully customizable HTML output.

**Drivers** add out-of-the-box support for different data sources (e.g. WordPress) and UI frameworks (e.g. Bootstrap).

---

Examples
--------

[](#examples)

### 1. Render a WordPress menu in 3 lines

[](#1-render-a-wordpress-menu-in-3-lines)

Got raw WordPress menu data? Just pass it in:

```
$menudata = [
    ['ID' => 1, 'menu_item_parent' => 0, 'menu_order' => 2, 'url' => '/about', 'title' => 'About us'],
    ['ID' => 2, 'menu_item_parent' => 1, 'menu_order' => 3, 'url' => '/team',  'title' => 'Team'],
    ['ID' => 3, 'menu_item_parent' => 0, 'menu_order' => 1, 'url' => '/',      'title' => 'Home'],
];

$favigation = new wwaz\Favigation\Driver\Wordpress\Builder(
    $menudata,
    wwaz\Favigation\Driver\BasicMenuRenderer::class
);
echo $favigation->toHtml();
```

**Output:**

```

    Home
    About us

            Team

```

Sorting by `menu_order`, nesting via `menu_item_parent` — all handled automatically.

---

### 2. Bootstrap navigation with active state

[](#2-bootstrap-navigation-with-active-state)

Want Bootstrap-compatible markup with the current page highlighted?

```
$favigation = (new wwaz\Favigation\Builder(
    new wwaz\Favigation\Collection($data),
    wwaz\Favigation\Driver\Bootstrap\BootstrapMenuRenderer::class
))
    ->tag('ul')
    ->id('main-nav')
    ->selected('getId', 3)  // Marks the item with ID 3 as active
    ->getBuild()
    ->toHtml();
```

The builder handles setting `active` classes — no need to traverse the tree yourself.

---

### 3. Fully custom HTML — icons, attributes, your own logic

[](#3-fully-custom-html--icons-attributes-your-own-logic)

Need total control over the markup?

```
$favigation
    ->setContent(function($item) {
        $icon = $item->getIcon()
            ? ''
            : '';

        return $item->getUrl()
            ? $icon . '' . $item->getTitle() . ''
            : $icon . '' . $item->getTitle() . '';
    })
    ->setLiAttribute('data-id', function($item) {
        return $item->getId();
    })
    ->toHtml();
```

**Output:**

```

    Home

        About us

            Team

```

Every element, every attribute — fully under your control, without managing the tree yourself.

---

Why Favigation?
---------------

[](#why-favigation)

Without FavigationWith FavigationWrite recursive functions yourself`toHtml()`Implement sorting manuallyAutomatic via `menu_order`Set active classes by hand`->selected('getId', $currentId)`Hard-wire framework-specific markupSwap out a driver---

Custom Drivers
--------------

[](#custom-drivers)

Favigation is extensible — write your own driver to support any data structure. Documentation available in the repository.

---

Developer Experience
--------------------

[](#developer-experience)

Useful local commands:

```
composer test
composer analyse
composer validate
```

`Driver\Wordpress\Builder` is provided as a backward-compatible alias and internally reuses `WordpressBuilder`.

---

License
-------

[](#license)

MIT License — see [LICENSE](LICENSE) for details.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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.

###  Release Activity

Cadence

Every ~216 days

Total

3

Last Release

73d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25566288?v=4)[WWAZ](/maintainers/WWAZ)[@WWAZ](https://github.com/WWAZ)

---

Top Contributors

[![WWAZ](https://avatars.githubusercontent.com/u/25566288?v=4)](https://github.com/WWAZ "WWAZ (11 commits)")

---

Tags

phpwordpressheadlessnavigation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wwaz-favigation-php/health.svg)

```
[![Health](https://phpackages.com/badges/wwaz-favigation-php/health.svg)](https://phpackages.com/packages/wwaz-favigation-php)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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