PHPackages                             awes-io/navigator - 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. awes-io/navigator

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

awes-io/navigator
=================

🧿 Build navigation or menu for Laravel and Awes.io. Unlimit complexity and depth of the menu.

v1.0.0(6y ago)4922.8k4MITPHP

Since Jul 8Pushed 6y ago5 watchersCompare

[ Source](https://github.com/awes-io/navigator)[ Packagist](https://packagist.org/packages/awes-io/navigator)[ Docs](https://github.com/awes-io/navigator)[ RSS](/packages/awes-io-navigator/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

 [ ![Awes.io logo](https://camo.githubusercontent.com/3411caf1ea53cc7f92a106e51ad617072eed81a7d52da1aca5eea4f96b6d001b/68747470733a2f2f7374617469632e617765732e696f2f70726f6d6f2f4c6f676f5f7369676e5f636f6c6f722e737667) ](https://www.awes.io/?utm_source=github&utm_medium=navigator)

Navigator
=========

[](#navigator)

Laravel package that can easily create navigation menus of any complexity. With support for routing, permissions, sorting, rendering depth, active items marking and element searching.

 [ ![Coverage report](https://camo.githubusercontent.com/cbb5e0e240c218628336e3af77f72d5d6c3ac567c3c090594a4c308421828aa0/68747470733a2f2f7265706f2e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f6261646765732f6d61737465722f636f7665726167652e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![Last version](https://camo.githubusercontent.com/5761404e7b4544e7292e35165989f86de888e1fab5a7b85225a710e10ea67593/68747470733a2f2f7777772e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f76657273696f6e2e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![Build status](https://camo.githubusercontent.com/d1b09b7d6f5b6e469758a603fb94e3dc7eb7af4824d46486fdd0f1da689f34c5/68747470733a2f2f7265706f2e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f6261646765732f6d61737465722f6275696c642e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![Downloads](https://camo.githubusercontent.com/b3b78e7c00261c6a5ba166e5a730ffde7da697fab3d7cb2a4a56fa109b835960/68747470733a2f2f7777772e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f646f776e6c6f6164732e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![License](https://camo.githubusercontent.com/cab76a2b2f0535f5b8f02c212f17767301346290d169e95542412bdf09951afe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617765732d696f2f6e6176696761746f722e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![CDN Ready](https://camo.githubusercontent.com/679c1c97c3a613b5f859cd64371c28aa9ec17e82d352b669e65a7f4f709cedb3/68747470733a2f2f7777772e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f7374617475732e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![laravel](https://camo.githubusercontent.com/6c8450706caac3ca057866b48ac77f9927d9b206811b156a7c3f05b8e1252b3b/68747470733a2f2f7374617469632e706b676b69742e636f6d2f6261646765732f6c61726176656c2e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![Last commit](https://camo.githubusercontent.com/f66d5adfd614ba89345f2ac56eca5667610467b4bc759f1ff6299a83a65dd809/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f617765732d696f2f6e6176696761746f722e737667) ](https://www.awes.io/?utm_source=github&utm_medium=shields) [ ![Analytics](https://camo.githubusercontent.com/7daa98f371586e6d07e0207523e3b98a363709664845f5518a1fe516c85d0b4b/68747470733a2f2f67612d626561636f6e2e61707073706f742e636f6d2f55412d3133343433313633362d312f617765732d696f2f6e6176696761746f72) ](https://github.com/awes-io/awes-io) [ ![Hosted by Package Kit](https://camo.githubusercontent.com/31a8a2063d3a2b5eae3ae31d0be49d4366bfcd848455e6a6cd39bb7b71cb2b97/68747470733a2f2f7777772e706b676b69742e636f6d2f6261646765732f686f737465642e737667) ](https://www.pkgkit.com/?utm_source=github&utm_medium=shields) [ ![Patreon](https://camo.githubusercontent.com/cc15e6db5bcba81594411e6ec54eb020345f90a5d21b37616523a18112cd41ff/68747470733a2f2f7374617469632e706b676b69742e636f6d2f6261646765732f70617472656f6e2e737667) ](https://www.patreon.com/join/awesdotio)

 [![Navigator Laravel](https://camo.githubusercontent.com/04196f9ba9e726d9280c4ab9dc662dd5b7a1f5d54eb39e1e1f3e8220e43e9c32/68747470733a2f2f7374617469632e617765732e696f2f6769746875622f6e6176696761746f722d636f7665725f332e706e67)](https://camo.githubusercontent.com/04196f9ba9e726d9280c4ab9dc662dd5b7a1f5d54eb39e1e1f3e8220e43e9c32/68747470733a2f2f7374617469632e617765732e696f2f6769746875622f6e6176696761746f722d636f7665725f332e706e67)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Quickstart](#quickstart)
- [Configuration](#configuration)
- [Usage](#usage)
- [Permissions](#permissions)
- [Testing](#testing)

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

[](#installation)

Via Composer

```
$ composer require awes-io/navigator
```

The package will automatically register itself.

Quickstart
----------

[](#quickstart)

Let's firstly create basic navigation, which covers most of the use cases.

Create navigation configuration file:

```
// config/navigation.php

return [
    [
        'name' => 'Projects',
        'route' => 'projects.index', // route must exist or item will be hidden
        'children' =>
        [
            [
                'name' => 'New projects',
                'link' => '/projects/new', // you can use direct links
            ]
        ]
    ],
    [
        'name' => 'Packages',
        'route' => 'packages.index',
    ]
];
```

Next, let's build our menu somewhere in the controller and pass it to a view:

```
$menu = buildMenu(config('navigation'));
return view('menu', compact('menu'));
```

And finally implement basic rendering logic:

```
// menu.blade.php
@foreach($menu as $item)

        @if($item->link())

              @if($item->isActive()) ACTIVE @endif {{$item->name}}

        @else
            {{$item->name}}
        @endif

    @if($item->hasChildren())
       @include('menu', ['menu' => $item->children()])
    @endif

@endforeach
```

That's all that simple!

Configuration
-------------

[](#configuration)

You can publish the config file:

```
php artisan vendor:publish --provider="AwesIO\Navigator\NavigatorServiceProvider" --tag="config"
```

And rename any options keys, which are used to get respective data from the menu config:

```
// navigator.php config
'keys' => [
    'depth' => 'depth', // rendering depth
    'order' => 'order', // ordering by parameter
    'children' => 'children', // sub menu items
    'route' => 'route', // route name
    'link' => 'link', // item link url
    'title' => 'name', // item title
    'attr' => 'attr', // additional item attributes
],
```

As well as use alternative menu settings for parsing and rendering:

```
// navigator.php config
'keys' => [
    ...
    'children' => 'other-children', // alternative sub menu items
    ...
],

// navigation.php
'menu' => [
    [
        ...
        'children' => [
        ...
        'other-children' => [
        ...
]

Navigator::buildMenu(config('navigation.menu')); // will now parse menu using 'other-children'
```

You can achieve the same effect dynamically, via mappings mentioned above:

```
$menu = buildMenu(config('navigation.menu'), [], ['children' => 'other-children']);
```

Note that we now use the global helper method `buildMenu()`.

Usage
-----

[](#usage)

```
use AwesIO\Navigator\Facades\Navigator;

$menu = Navigator::buildMenu(config('navigation.menu'), ['depth' => 2], [], function ($item) {
    $item->put('meta', $item->get('title') . ' / ' . $item->get('link'));
});

// using helper, rendering depth set via config as a second parameter
$menu = buildMenu(config('navigation.menu'), ['depth' => 2], [], function ($item) {});
```

The first parameter is the menu config in the form of an array:

```
// navigation.php
return [
    'menu' => [
        [
            'title' => 'Products', // menu item's title
            'route' => 'products.index', // route name for URL generation
            'order' => 1, // parameter to determine the order
            'depth' => 1, // depth for the recursive generation of descendants
            'children' =>
            [
                [
                    'id' => 1, // custom id which overwrites auto-generated one
                    'title' => 'Catalog',
                    'link' => 'products/catalog', // explicit relative path for link URL
                ],
                [
                    'title' => 'Support',
                    'route' => 'products.support'
                ]
            ]
        ],
        [
            'title' => 'Contact us',
            'route' => 'contacts',
            'order' => 2,
        ],
    ]
];
```

Second is config, the third one is mappings for configuration parameters (described above), last is a callback, which will be applied to each menu item.

### Some helpful methods

[](#some-helpful-methods)

Determine if the node has any children and retrieve them:

```
$menu->hasChildren();
$menu->children();
```

Get a link URL for a node:

```
$menu->link();
```

Determine if a node is currently selected and active:

```
$menu->isActive();
```

Get a currently active node and its id:

```
$menu->getActive();
$menu->getActiveId();
```

Find a node by its id:

```
$menu->findById($id);
```

Menu rendering example
----------------------

[](#menu-rendering-example)

```
// somewhere in a controller
$menu = Navigator::buildMenu(config('navigation.menu'));
return view('view', compact('menu'));

// view.blade.php
@extends('main')

@section('content')
    @include('menu', ['menu' => $menu])
@endsection

// menu.blade.php
@foreach($menu as $item)

        @if($item->link())
            {{$item->title}}
        @else
            {{$item->title}}
        @endif

    @if($item->hasChildren())
       @include('menu', ['menu' => $item->children()])
    @endif

@endforeach
```

Permissions
-----------

[](#permissions)

If the user is not authorized to access some of the menu routes, they'll be automatically hidden based on existing permissions:

```
Route::group(['middleware' => ['can:manage users']], function () {
    Route::get('/', 'RoleController@index')->name('admin.roles.index');
});

// will be excluded from the menu for non-admin users
[
    'name' => __('navigation.security'),
    'icon' => 'twousers',
    'route' => 'admin.roles.index',
],
```

Testing
-------

[](#testing)

The coverage of the package is [![Coverage report](https://camo.githubusercontent.com/cbb5e0e240c218628336e3af77f72d5d6c3ac567c3c090594a4c308421828aa0/68747470733a2f2f7265706f2e706b676b69742e636f6d2f344742574f2f617765732d696f2f6e6176696761746f722f6261646765732f6d61737465722f636f7665726167652e737667)](https://www.awes.io/?utm_source=github&utm_medium=shields).

You can run the tests with:

```
composer test
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Credits
-------

[](#credits)

- [Alexander Osokin](https://thealex.ru)
- [Galymzhan Begimov](https://github.com/begimov)
- \[All Contributors\]\[link-contributors\]

License
-------

[](#license)

[MIT](http://opensource.org/licenses/MIT)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 94.9% 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 ~12 days

Total

3

Last Release

2526d ago

Major Versions

v0.0.2 → v1.0.02019-07-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/7932461f5d3d8775210ba7ff5487258ff23c274648a9936341112158aa487480?d=identicon)[Yevhen L.](/maintainers/Yevhen%20L.)

---

Top Contributors

[![begimov](https://avatars.githubusercontent.com/u/3600510?v=4)](https://github.com/begimov "begimov (37 commits)")[![falkon](https://avatars.githubusercontent.com/u/576750?v=4)](https://github.com/falkon "falkon (1 commits)")[![yevhenlisovenko](https://avatars.githubusercontent.com/u/11060056?v=4)](https://github.com/yevhenlisovenko "yevhenlisovenko (1 commits)")

---

Tags

awes-iolaravellaravel-menularavel-navigationmenunavigationlaravelmenunavigationlaravel-menuLaravel-Navigationnavigatorawes-io

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/awes-io-navigator/health.svg)

```
[![Health](https://phpackages.com/badges/awes-io-navigator/health.svg)](https://phpackages.com/packages/awes-io-navigator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[caffeinated/menus

Laravel Menus

132160.3k5](/packages/caffeinated-menus)[akaunting/laravel-menu

Menu and sidebar management package for Laravel

38248.3k](/packages/akaunting-laravel-menu)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.4k](/packages/nedwors-navigator)[kodicomponents/navigation

The KodiCMS Support package.

12236.3k11](/packages/kodicomponents-navigation)[kodicomponents/support

The KodiCMS Support package.

10259.8k12](/packages/kodicomponents-support)

PHPackages © 2026

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