PHPackages                             vector88/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vector88/laravel-navigation

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

vector88/laravel-navigation
===========================

Navigation module for Laravel

1.0.2(8y ago)016PHPPHP &gt;=5.6.4

Since Jun 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/vector-kerr/laravel-navigation)[ Packagist](https://packagist.org/packages/vector88/laravel-navigation)[ RSS](/packages/vector88-laravel-navigation/feed)WikiDiscussions master Synced 3d ago

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

laravel-navigation
==================

[](#laravel-navigation)

Generate contextual navigation trees using Events and Listeners.

The Navigation Service Provider should allow you to create highly dynamic menu structures by making use of an event/listener system. By passing through a `context` object of your choice, you can also completely change the way that the menu generation works depending on the value you pass in.

Installation
============

[](#installation)

1. Require the `laravel-navigation` package in your Laravel project.

    `composer require vector88/laravel-navigation`
2. Add the `NavigationServiceProvider` to the `providers` array in `config/app.php`:

    ```
    'providers' => [
        ...
        Vector88\Navigation\NavigationServiceProvider::class,
        ...
    ],
    ```

Usage
=====

[](#usage)

Create an Event Listener
------------------------

[](#create-an-event-listener)

This listener will be executed whenever the Build Navigation event is invoked. The following example adds a simple 'home' link to the top level of the navigation structure for every Build Navigation event.

The Build Navigation event handler takes a `BuildNavigation` event object in the `handle` call, and you can add `NavigationItem` instances to the navigation tree by using the `add()` method of the `BuildNavigation` object.

```
