Download the PHP package log1x/navi without Composer

On this page you can find all versions of the php package log1x/navi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package navi

Navi

Latest Stable Version Total Downloads Build Status

Hate the WordPress NavWalker? Me too.

Navi is a developer-friendly alternative to the NavWalker. Easily build your WordPress menus using an iterable object inside of a template/view.

Requirements

Installation

Bedrock (or Sage)

Install via Composer:

Manual

Download the latest release .zip and install into wp-content/plugins.

Usage

Building your menu can be done by passing your menu location to Navi::make()->build():

By default, build() uses primary_navigation if no menu location is specified.

Retrieving an array of menu items can be done using all():

[!NOTE] Check out the examples folder to see how to use Navi in your project.

Menu Item Classes

By default, Navi removes the default WordPress classes from menu items such as menu-item and current-menu-item giving you full control over your menu markup while still passing through custom classes.

If you would like these classes to be included on your menu items, you may call withDefaultClasses() before building your menu:

In some situations, plugins may add their own classes to menu items. If you would like to prevent these classes from being added, you may pass an array of partial strings to withoutClasses() match against when building.

Accessing Menu Object

When building the navigation menu, Navi retains the menu object and makes it available using the get() method.

By default, get() returns the raw wp_get_nav_menu_object() allowing you to access it directly.

Optionally, you may pass a key and default to call a specific object key with a fallback when the value is blank:

Accessing Page Objects

If your menu item is linked to a page object (e.g. not a custom link) – you can retrieve the ID of the page using the objectId attribute.

Below is an example of getting the post type of the current menu item:

Accessing Custom Fields

In a scenario where you need to access a custom field attached directly to your menu item – you can retrieve the ID of the menu item using the id attribute.

Below we'll get a label override field attached to our menu using ACF – falling back to the default menu label if the field is empty.

Acorn Usage

If you are using Navi alongside Acorn (e.g. Sage), you may generate a usable view component using Acorn's CLI:

Once generated, you may use the view component in an existing view like so:

To list all registered locations and their assigned menus, you can use the list command:

Example Output

When calling build(), Navi will retrieve the WordPress navigation menu assigned to the passed location and build out an array containing the menu items.

An example of the menu output can be seen below:

Bug Reports

If you discover a bug in Navi, please open an issue.

Contributing

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

License

Navi is provided under the MIT License.


All versions of navi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package log1x/navi contains the following files

Loading the files please wait ....