PHPackages                             anekdotes/menus - 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. anekdotes/menus

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

anekdotes/menus
===============

Utility to generate a static array full of links

2.0.1(3y ago)1433MITPHPPHP &gt;=7.4.0

Since Aug 9Pushed 3y ago2 watchersCompare

[ Source](https://github.com/anekdotes/menus)[ Packagist](https://packagist.org/packages/anekdotes/menus)[ RSS](/packages/anekdotes-menus/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

Anekdotes Menus
===============

[](#anekdotes-menus)

[![Latest Stable Version](https://camo.githubusercontent.com/7adc9f2f38544de4a2aa5d1b605010230885714622b7fa8b516012207ee065de/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f6d656e75732f762f737461626c65)](https://packagist.org/packages/anekdotes/menus)[![Build Status](https://camo.githubusercontent.com/3a094465a66c6c22ad893a2deafac09425c8356f8e0481ab9d4ada1fbf7d9b59/68747470733a2f2f7472617669732d63692e6f72672f616e656b646f7465732f6d656e75732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/anekdotes/menus)[![codecov.io](https://camo.githubusercontent.com/30426cb41a204d6347d7de2d0a47d59da625d53dcf958fda7cc4e1353b1c6682/68747470733a2f2f636f6465636f762e696f2f6769746875622f616e656b646f7465732f6d656e75732f636f7665726167652e737667)](https://codecov.io/github/anekdotes/menus?branch=master)[![StyleCI](https://camo.githubusercontent.com/0782ee58123e3d4256d2f0bf0232de9da42964769e7602a800d4c34f50f23802/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353239343336342f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/65294364)[![License](https://camo.githubusercontent.com/8e8b67410ce8b608c73a2a5931d202e1e82b533c655570636c23f6e49fb1edfd/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f6d656e75732f6c6963656e7365)](https://packagist.org/packages/anekdotes/menus)[![Total Downloads](https://camo.githubusercontent.com/8d51a708992b99f760bf43fc5009d7ff8449e5a14baff8bd7faa058de7383501/68747470733a2f2f706f7365722e707567782e6f72672f616e656b646f7465732f6d656e75732f646f776e6c6f616473)](https://packagist.org/packages/anekdotes/menus)[![Codacy Badge](https://camo.githubusercontent.com/3e7793a725dc4d70f5a695081466b6ac671ca4ec6df1e62bb8f2f2f6c262dd62/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3530313334666562636566653463633738646166303763613435393639373238)](https://www.codacy.com/app/Grasseh/menus?utm_source=github.com&utm_medium=referral&utm_content=anekdotes/menus&utm_campaign=Badge_Grade)

---

Utility to generate an intelligent "range" of links based on the current page and total pages.

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

[](#installation)

Install via composer in your project :

```
composer require anekdotes/menus

```

Basic usage
-----------

[](#basic-usage)

Load the class

```
  use Anekdotes\Menus\Menus;
```

Add menu using the class' method

```
  Menus::addItem('test 1', '/test1', 'fa-potato');
```

You can also specify the level and position

```
  Menus::addItem('test 1', '/test1', 'fa-potato', 1, 1);
```

You can also add a namespace

```
  Menus::addItem('test 1', '/test1', 'fa-potato', 1, 1, 'potato');
```

Fetch all main menus

```
  $items = Menus::main();
```

Or get all menus from a desired level and namespace

```
  $items = Menus::get('potato', 1);
```

Advanced
--------

[](#advanced)

#### addItem

[](#additem)

Method to add an item to the menu's array

```
  Menus::addItem($title, $url, $icon, $level, $position, $namespace);
  //$title the link title/name/text
  //$url the link url
  //$icon the link icon (font-awesome, ex: fa-times)
  //$level the link level (default: 1)
  //$position the link position (default: 0)
  //$namespace the link namespace (default: "")
```

#### removeItem

[](#removeitem)

Method to remove an item from the menu's array

```
  Menus::removeItem($level, $position);
  //$level link level
  //$position the link position
```

#### find

[](#find)

Method to find a specific item from the menu's array

```
  Menus::find($level, $position);
  //$level link level
  //$position the link position
```

#### main

[](#main)

Method to get all level 1 item

```
  Menus::main($sort);
  //$sort sorting either SORT_ASC or SORT_DESC (default: SORT_ASC)
```

#### clear

[](#clear)

Method to clear all items from menu's array

```
  Menus::clear();
```

#### get

[](#get)

Method to get all item from desired level and namespace

```
  Menus::get($namespace, $level);
  //$namespace the link namespace (default: "")
  //$level the link level (default: 1)
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~550 days

Total

5

Last Release

1410d ago

Major Versions

1.2.0 → 2.0.02021-11-24

PHP version history (2 changes)1.0.0PHP &gt;=5.6.0

2.0.0PHP &gt;=7.4.0

### Community

Maintainers

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

---

Top Contributors

[![franatieu](https://avatars.githubusercontent.com/u/4522233?v=4)](https://github.com/franatieu "franatieu (10 commits)")[![Grasseh](https://avatars.githubusercontent.com/u/2159610?v=4)](https://github.com/Grasseh "Grasseh (2 commits)")

---

Tags

linkmenumenuslinks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anekdotes-menus/health.svg)

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

###  Alternatives

[knplabs/knp-menu

An object oriented menu library

1.4k57.3M324](/packages/knplabs-knp-menu)[knplabs/knp-menu-bundle

This bundle provides an integration of the KnpMenu library

1.4k55.3M375](/packages/knplabs-knp-menu-bundle)

PHPackages © 2026

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