PHPackages                             t4web/navigation - 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. [Templating &amp; Views](/categories/templating)
4. /
5. t4web/navigation

ActiveLibrary[Templating &amp; Views](/categories/templating)

t4web/navigation
================

ZF2 Module which simplifies creationiewing menus

1.0.5(10y ago)0127BSD-3-ClausePHPPHP &gt;=5.4.0

Since Oct 24Pushed 10y ago2 watchersCompare

[ Source](https://github.com/t4web/Navigation)[ Packagist](https://packagist.org/packages/t4web/navigation)[ Docs](https://github.com/t4web/Navigation)[ RSS](/packages/t4web-navigation/feed)WikiDiscussions master Synced 1mo ago

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

Navigation
==========

[](#navigation)

ZF2 Module which simplifies creating and viewing menus

Usage
-----

[](#usage)

Add Navigation repo in yours require in composer.json:

```
"repositories": [
    {
        "type": "git",
        "url": "https://github.com/t4web/navigation.git"
    }
],
"require": {
    "t4web/navigation": "dev-master"
}
```

In your project, for example in modules/Application/Module.php, you can add Navigation service:

```
'factories' => array(
      'UserNavigation' => function (ServiceLocatorInterface $sl) {
          $factory =  new T4webNavigation\Factory();
          return $factory->createService($sl);
      },
  )
```

In your BootstrapListener you can add menu entries:

```
public function onBootstrap(EventInterface $e)
{
    $sl = $e->getApplication()->getServiceLocator();
    $navigarot = $sl->get('T4webNavigation\Menu\Navigator');
    $navigator->addEntry('Dashboard', 'home', 'fa fa-dashboard');
    $navigator->addEntry('Employees', 'employees-list', 'fa fa-users');
    $navigator->addEntry(TITLE, ROUTE, ENTRY_ICON_CLASS);
}
```

where `TITLE` - title in meny entry, `ROUTE` - route from module config, `ENTRY_ICON_CLASS` - class for &lt;i&gt; tag.

After this you can add in your layout menu rendering:

```
