New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

dowilcox/knp-menu-laravel

Laravel package to create navigation menus, based on KnpLabs/KnpMenu.
3,422 4
Install
composer require dowilcox/knp-menu-laravel
Latest Version:1.0.1
Laravel:5
License:MIT
Last Updated:Nov 11, 2016
Links: GitHub  ·  Packagist
Maintainer: dowilcox

KnpMenu-Laravel

Laravel 5 package to create navigation menus, based on KnpLabs/KnpMenu.

Installation

Add to your composer.json file

"dowilcox/knp-menu-laravel": "1.0.*"

Register the package

In config/app.php add the service provider and alias.

Dowilcox\KnpMenu\MenuServiceProvider::class,
'Menu' => Dowilcox\KnpMenu\Facades\Menu::class,
Publish config
php artisan vendor:publish

Example

$menu = Menu::create('main-menu', ['childrenAttributes' => ['class' => 'nav']]);

$menu->addChild('Home', ['uri' => url('/')]);
$menu->addChild('Users', ['uri' => route('admin.users.index')]);
$menu->addChild('Roles', ['uri' => route('admin.roles.index')]);
$menu->addChild('Menu', ['uri' => url('menu')]);

echo Menu::render($menu);

Will output:

<ul class="nav">
  <li class="first">
    <a href="http://localhost:8000">Home</a>
  </li>
  <li>
    <a href="http://localhost:8000/admin/users">Users</a>
  </li>
  <li>
    <a href="http://localhost:8000/admin/roles">Roles</a>
  </li>
  <li class="current active last">
    <a href="http://localhost:8000/menu">Menu</a>
  </li>
</ul>

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

655,942,320 9,702
laravel/framework

The Laravel Framework.

610,364,751 34,988
laravel/tinker

Powerful REPL for the Laravel framework.

524,145,802 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

442,489,569 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

412,228,818 4,664

Version History

Version Released Laravel License
1.0.1 ~5.0 || ~5.1 MIT
1.0.0 5.0.* MIT
0.0.1 5.0.* MIT