Download the PHP package enimiste/knp-menu-laravel without Composer
On this page you can find all versions of the php package enimiste/knp-menu-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enimiste/knp-menu-laravel
More information about enimiste/knp-menu-laravel
Files in enimiste/knp-menu-laravel
Package knp-menu-laravel
Short Description Laravel package to create navigation menus, based on KnpLabs/KnpMenu. Fork of dowilcox/KnpMenu-Laravel package
License MIT
Informations about the package knp-menu-laravel
KnpMenu-Laravel
Laravel 5 package to create navigation menus, based on KnpLabs/KnpMenu.
Installation
Add to your composer.json file
Register the package
In config/app.php add the service provider and alias.
To Access the menu service directly :
Publish config
Custom Rendrer
To define your custom renderer :
- Implements the interface "Knp\Menu\Renderer\RendererInterface"
- Register a binding to "knp_menu.renderer" that returns a new instance of your new custom renderer. To get the matcher use
$app["knp_menu.matcher"]
Custom Voter
To add custom Voter you implement the interface "Dowilcox\KnpMenu\Voter\OrderedVoterInterface" and register it in the service container with the tag "knp_menu.voter"
Set the lower order for Voter that should be executed in first.
It is recommended order values between 0 and than 100.
Your Voters will be executed first before the built in ones.
- RouteNameVoter (100)
- UriVoter (200 and 300)
Blade directives
- @rendermenu("main" [, {"firstClass":"first2","lastClass":"last2"}]) or @rendermenu("main" [, "config_name"]): It renders the menu defined by the name "menu_name". It is a shortcut to
echo \Menu::render(\Menu::get('menu_name'))
- @menu('menu_name') .... @endmenu : between these two directives you have access to a variable named
$menu
holding the menu defined by the name "menu_name". This object is an instance ofKnp\Menu\MenuItem
Example
Will output:
All versions of knp-menu-laravel with dependencies
illuminate/support Version ~5.0 || ~5.1 || ~5.2 || ~5.3
illuminate/routing Version ^5.2