Download the PHP package popphp/pop-nav without Composer
On this page you can find all versions of the php package popphp/pop-nav. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download popphp/pop-nav
More information about popphp/pop-nav
Files in popphp/pop-nav
Package pop-nav
Short Description Pop Nav Component for Pop PHP Framework
License BSD-3-Clause
Homepage http://www.popphp.org/
Informations about the package pop-nav
pop-nav
- Overview
- Install
- Quickstart
- Config
- Using ACL
Overview
pop-nav
is a component for managing and rendering an HTML navigation tree. It includes support for
injecting ACL functionality to display only the certain branches of the navigation tree that the
current user role is allowed to access. For that, the pop-acl
component is used.
pop-nav
is a component of the Pop PHP Framework.
Top
Install
Install pop-nav
using Composer.
composer require popphp/pop-nav
Or, require it in your composer.json file
"require": {
"popphp/pop-nav" : "^4.0.0"
}
Top
Quickstart
First, you can define the navigation tree:
Then you can pass that to the nav object and render the nav:
Top
Config
You have a significant amount of control over the branch nodes and attributes via a configuration array:
Using the same navigation tree from above, you can then create and render your nav object with the config:
Top
Using ACL
First, let's set up the ACL object with some roles and resources:
And then we add the ACL rules to the navigation tree:
We then inject the ACL object into the navigation object, set the current role and render the navigation:
Because the 'editor' role is denied access to the config
page, that nav branch is not rendered. However,
if the role is set to $admin
, the config
branch renders:
Top
All versions of pop-nav with dependencies
popphp/pop-acl Version ^4.0.1
popphp/pop-dom Version ^4.0.2
popphp/pop-utils Version ^2.1.0