PHPackages                             bhoeting/navigation-builder - 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. bhoeting/navigation-builder

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

bhoeting/navigation-builder
===========================

A Blade helper to easily create Navigation HTML.

1.3.1(11y ago)151PHPPHP &gt;=5.4.0

Since Jul 17Pushed 11y ago1 watchersCompare

[ Source](https://github.com/bhoeting/NavigationBuilder)[ Packagist](https://packagist.org/packages/bhoeting/navigation-builder)[ RSS](/packages/bhoeting-navigation-builder/feed)WikiDiscussions master Synced 3w ago

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

### This project will not be updated for Laravel 5.

[](#this-project-will-not-be-updated-for-laravel-5)

NavigationBuilder
=================

[](#navigationbuilder)

A navigation HTML generator for Laravel.

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

[](#installation)

```
"require": {
	"bhoeting/navigation-builder": "*"
}
```

Run `composer install`

Add the service provider to the `providers` array in `app/config/app.php`

```
'bhoeting\NavigationBuilder\NavigationServiceProvider',
```

Then add the facade to the `aliases` array

```
'Navigation' => 'bhoeting\NavigationBuilder\Navigation'
```

Usage
-----

[](#usage)

### Basic

[](#basic)

```
{{ Navigation::create(['home', 'about', 'contact'] }}
```

Will generate:

```

		Home

		About

		Contact

```

By default, a Bootstrap template is used to generate the HTML. See Advanced on how you can create your own templates. Also note that the `about` item has an a class of `active`. This is because the current URL is the same as the about item's link. Items are also active when the current URL matches a pattern of the item's link. For instance, `http://localhost:8000/about/who-we-are` will also make the `about` item active.

The display text and URL for each item are based on the strings provided in the array. You can specify your own like so:

```
{{ Navigation::create(['home' => ['url' => '/'], 'about' => ['text' => 'about-us'], 'contact' => ['route' => 'contact.us']]) }}
```

Output:

```

		Home

		About-us

		Contact

```

You can also associate a Font Awesome Icon to be displayed next to the Item's text.

```
{{ Navigation::create(['home' => ['url' => '/', 'icon' => 'user']]) }}
```

Will output:

```
...

	 Home

```

### Advanced

[](#advanced)

You can easily re-use and configure Navigations by extending the provided `AbstractNavigaiton` and specify your own templates, active class, and Items.

```
// app/Acme/Navigation/MasterNavigation.php
