PHPackages                             anetwork/sidenav - 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. anetwork/sidenav

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

anetwork/sidenav
================

1.0.0(9y ago)21.2k4MITPHPPHP &gt;=5.5

Since Oct 9Pushed 8y ago2 watchersCompare

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

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

[![Build Status](https://camo.githubusercontent.com/af9eb767ea9b6e950846357050676dfae47761b0d3f9311fe6d10664714ef88f/68747470733a2f2f7472617669732d63692e6f72672f616e6574776f726b2f736964656e61762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/anetwork/sidenav)[![Latest Stable Version](https://camo.githubusercontent.com/2a7aec41d1d692b3268de954bc4a77244a7fd35a130b70ab91ee2f5e3c2628b1/68747470733a2f2f706f7365722e707567782e6f72672f616e6574776f726b2f736964656e61762f762f737461626c65)](https://packagist.org/packages/anetwork/sidenav)[![Total Downloads](https://camo.githubusercontent.com/7e82ee5645badcb52f2474044c03105d4707d4bfbbeae49cfea2ddcd5732fdc5/68747470733a2f2f706f7365722e707567782e6f72672f616e6574776f726b2f736964656e61762f646f776e6c6f616473)](https://packagist.org/packages/anetwork/sidenav)[![Latest Unstable Version](https://camo.githubusercontent.com/7eafcd65e3e7720ebe800063a0c03f46121e14837f5a31fd7dfe3f326456610a/68747470733a2f2f706f7365722e707567782e6f72672f616e6574776f726b2f736964656e61762f762f756e737461626c65)](//packagist.org/packages/anetwork/sidenav)[![License](https://camo.githubusercontent.com/9e0a0ccc4bbdf663ad4975ff74ca78ae601d908ec0968520764b83e8840c2fa0/68747470733a2f2f706f7365722e707567782e6f72672f616e6574776f726b2f736964656e61762f6c6963656e7365)](https://packagist.org/packages/anetwork/sidenav)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fe3d36012837d621bbcf6f9ec98998a6dea87e7c3c60432dd28e93f96d42d59b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e6574776f726b2f736964656e61762f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/anetwork/sidenav/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/443e691e30e44449c4d81c37415fd052233a725c11cc6376331414c6ea9be1cb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e6574776f726b2f736964656e61762f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/anetwork/sidenav/?branch=master)

Anetwork SideNav
================

[](#anetwork-sidenav)

SideNav is a PHP package which helps you generate powerful sidebar navigation.

Features
========

[](#features)

- SubMenu : Define your submenu to item
- Grouping : Define your items in groups
- Cheking : Define dynamic menues and submenues with if statement support

Introduction
============

[](#introduction)

- A php component that makes it easier to build vertical nav menus
- The sidenav package can manage your sidebar navigations items on your project
- you can install this package with composer and config your sidebar navigations items

Requirement
-----------

[](#requirement)

- php 5.5 &gt;=
- HHVM

Install with composer
---------------------

[](#install-with-composer)

You can install this package throw the [Composer](http://getcomposer.org) by running:

```
composer require anetwork/sidenav

```

Register a new item
-------------------

[](#register-a-new-item)

- you should use the register method of sidenav object
- the method wants 2 arguments
- the first one should be a string of your item name
- the second one must be a function literal to use Menu Object for define all of menu options

```
SideNav::register('item_name',function($menu){

    $menu->link('the_item_url');

    $menu->title('the title');

    $menu->className('class-name'); // Item css class attribute

    $menu->icon('fa fa-example'); //  use on font-awesome icon

    // Register submenu to item
    $menu->sub('sub_item_name',function ($menu){
        $menu->link('the_item_url');
        $menu->title('the submenu title');
        $menu->icon('fa fa-example');
        $menu->className('submenu-class-name');
    });

    /**
     *
     * Register another one ...
     *
     */

});
```

Register submenu with Check Status
----------------------------------

[](#register-submenu-with-check-status)

If you want register a submenu in item with checkStatus, you should use subWithCheck method of Menu Object

- the method , accepts 3 arguments
- first one must be a string of your item name
- second one must be function literal to use Menu Object for define all of menu options
- third one must be a function literal of your check state , return of function must be true or false

```
SideNav::register('item_name',function($menu){

    /**
     *
     * Items options ...
     *
     */

     $menu->subWithCheck('sub_item_name',function($menu){

        /**
         *
         * Item options ...
         *
         */

     },functiion(){

        // checking area
        // you can define the if statement here to return boolean | true or false
        // :: Example

        if($_SESSION['user_id'] == 2){
            return true;
        }

        return false;

     });

});
```

Register With Check Status
--------------------------

[](#register-with-check-status)

If you want register a item with checkStatus, you should use registerWithCheck method of SideNav Object

- the method , accepts 3 arguments
- first one must be a string of your item name
- second one must be function literal to use Menu Object for define all of menu options
- third one must be a function literal of your check state , return of function mustb be true or false

```
SideNav::registerWithCheck('item_name',function($menu){

    $menu->link('the_item_url');

    $menu->title('the title');

    $menu->className('class-name');

    $menu->icon('fa fa-example');

},function(){

    // checking area
    // you can define the if statement here to return boolean | true or false
    // :: Example

    if($_SESSION['user_id'] == 2){
        return true;
    }
    return false;
});
```

Group
-----

[](#group)

- You can make a group menu with SideNav::group method

```
SideNav::group('user',function(){

    // Registering Items

});
```

### Render

[](#render)

- You can use the render method of SideNav object to return your menu array

```
SideNav::render();
```

- if you want to render your group , just call your group name in argument

```
SideNav::render('name_of_your_group');
```

### Menu options

[](#menu-options)

MethodstatusParameterType of parameter`->icon()`requiredDefine icon classString`->link()`requiredSet link of itemString`->regex()`optionalSet the regex of item linkarray`->className()`optionalThe class of itemString`->newTab()`optionalnewTab link targetBoolean : defalt =&gt; false`->title()`requiredThe title of itemString`->isNew()`optionalDefine the item is newBoolean : default =&gt; false`->selected()`optionalitem selected statusBoolean : default =&gt; false`->openChildOnClick()`optionalthe sub menu statusBoolean : default =&gt; true

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~11 days

Total

5

Last Release

3504d ago

Major Versions

0.0.4 → 1.0.02016-11-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/777517a63bd0dc7990a0e1642b0660cc3662b49d8565ff3542a23e1560c7187f?d=identicon)[imehdihosseini](/maintainers/imehdihosseini)

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

---

Top Contributors

[![mrjosh](https://avatars.githubusercontent.com/u/9644368?v=4)](https://github.com/mrjosh "mrjosh (36 commits)")[![imehdihosseini](https://avatars.githubusercontent.com/u/2538971?v=4)](https://github.com/imehdihosseini "imehdihosseini (2 commits)")

---

Tags

sidebarsidebar-navigationsidenavsubmenu

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anetwork-sidenav/health.svg)

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

###  Alternatives

[ahuggins/open-on-make

Automatically open files in editor when Artisan make:\* is executed

9920.2k](/packages/ahuggins-open-on-make)[nystudio107/richvariables

Allows you to easily use Craft Globals as variables in Rich Text fields

441.5k](/packages/nystudio107-richvariables)

PHPackages © 2026

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