Download the PHP package awes-io/navigator without Composer
On this page you can find all versions of the php package awes-io/navigator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download awes-io/navigator
More information about awes-io/navigator
Files in awes-io/navigator
Package navigator
Short Description 🧿 Build navigation or menu for Laravel and Awes.io. Unlimit complexity and depth of the menu.
License MIT
Homepage https://github.com/awes-io/navigator
Informations about the package 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.
Table of Contents
- Installation
- Quickstart
- Configuration
- Usage
- Permissions
- Testing
Installation
Via Composer
The package will automatically register itself.
Quickstart
Let's firstly create basic navigation, which covers most of the use cases.
Create navigation configuration file:
Next, let's build our menu somewhere in the controller and pass it to a view:
And finally implement basic rendering logic:
That's all that simple!
Configuration
You can publish the config file:
And rename any options keys, which are used to get respective data from the menu config:
As well as use alternative menu settings for parsing and rendering:
You can achieve the same effect dynamically, via mappings mentioned above:
Note that we now use the global helper method buildMenu()
.
Usage
The first parameter is the menu config in the form of an array:
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
Determine if the node has any children and retrieve them:
Get a link URL for a node:
Determine if a node is currently selected and active:
Get a currently active node and its id:
Find a node by its id:
Menu rendering example
Permissions
If the user is not authorized to access some of the menu routes, they'll be automatically hidden based on existing permissions:
Testing
The coverage of the package is .
You can run the tests with:
Contributing
Please see contributing.md for details and a todolist.
Credits
- Alexander Osokin
- Galymzhan Begimov
- [All Contributors][link-contributors]