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

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

zrnik/menu
==========

S1mple menu model.

v0.0.1(5y ago)1660MITPHP

Since Dec 26Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Menu
====

[](#menu)

With this you can define your menu, and then draw it somewhere.

It uses `nette/component-model` package.

It contains 2 classes:

- **Zrnik\\Menu\\Url** - this is a `Nettte\Http\Url`, but implementing `Nette\ComponentModel\IComponent`.
- **Zrnik\\Menu\\Menu** - this is a container (extending `Nette\ComponentModel\Container`), but changed, so it only takes `Url` or `Menu` as a child.

Both classes have an additional parameter and public property `$label`.

Thats all.

### Requirements:

[](#requirements)

`PHP >= 8.0`

### Example usage:

[](#example-usage)

```
include __DIR__.'/vendor/autoload.php';

/*
 * Example definition
 */

$menu = new \Zrnik\Menu\Menu();
$menu->addLink("Home", "/home/");
$menu->addLink("Blog", "/blog/");
$support = $menu->addMenu("Support");
$support->addLink("Contact us!", "/support/contact");
$support->addLink("FAQ", "/support/faq");

/*
 * Example usage
 */

function menuItem(\Zrnik\Menu\Menu $menu, int $level = 0)
{
    foreach($menu->getComponents() as $item)
    {
        if($item instanceof \Zrnik\Menu\Menu)
        {
            echo str_repeat(" ",$level).$item->label.":".PHP_EOL;
            menuItem($item, $level+1);
        }

        if($item instanceof \Zrnik\Menu\Url)
        {
            echo str_repeat(" ",$level).
                sprintf('%s', $item->getAbsoluteUrl(), $item->label);

            echo PHP_EOL;
        }
    }
}

menuItem($menu);
```

### Result:

[](#result)

```
Home
Blog
Support:
 Contact us!
 FAQ
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

2014d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/55077930?v=4)[Štěpán Zrník](/maintainers/zrnik)[@Zrnik](https://github.com/Zrnik)

---

Top Contributors

[![Zrnik](https://avatars.githubusercontent.com/u/55077930?v=4)](https://github.com/Zrnik "Zrnik (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54413.6M512](/packages/nette-forms)[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.3k72.7M762](/packages/nette-php-generator)[nette/component-model

⚛ Nette Component Model

28817.0M106](/packages/nette-component-model)[nette/application

🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.

45715.9M1.1k](/packages/nette-application)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5275.9M121](/packages/symplify-monorepo-builder)[shipmonk/input-mapper

Performant array-to-object mapper supporting generics, array shapes, optional fields and much more!

3030.9k](/packages/shipmonk-input-mapper)

PHPackages © 2026

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