Download the PHP package vector88/laravel-navigation without Composer

On this page you can find all versions of the php package vector88/laravel-navigation. 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 laravel-navigation

laravel-navigation

Generate contextual navigation trees using Events and Listeners.

The Navigation Service Provider should allow you to create highly dynamic menu structures by making use of an event/listener system. By passing through a context object of your choice, you can also completely change the way that the menu generation works depending on the value you pass in.

Installation

  1. Require the laravel-navigation package in your Laravel project.

    composer require vector88/laravel-navigation

  2. Add the NavigationServiceProvider to the providers array in config/app.php:

Usage

Create an Event Listener

This listener will be executed whenever the Build Navigation event is invoked. The following example adds a simple 'home' link to the top level of the navigation structure for every Build Navigation event.

The Build Navigation event handler takes a BuildNavigation event object in the handle call, and you can add NavigationItem instances to the navigation tree by using the add() method of the BuildNavigation object.

Register the Event Listener

The easiest way to register the Event Listener is by adding it to the $listen associative array in your App\Providers\EventServiceProvider class. For example:

Invoke the Event

To build the navigation tree, call the build() function of the Navigation service. Get the Navigation Service by using dependency injection, or by using the make() method. When retrieving the Navigation service you should use the provided Contract rather than the service class directly.

You can also resolve and use the Navigation Service directly within a blade file by using the @inject directive:

Navigation Context Object

The BuildNavigation event object can hold a context object. This object is just a variable, and you can put whatever you like in it. The $navigationService->build() function takes a single optional argument which will be passed through as the context object. This context object can then be accessed by retrieving the context member of the buildNavigation event.

This simple arrangement can allow you to pass basic variables like strings or integers through to the build navigation event listeners, which you can perform checks against. You can also pass complex objects like class instances and perform more in-depth tasks on that object if you prefer.

If you do not provide a context object when you call build(), then $buildNavigation->context is set to null.

Navigation Item Object

The NavigationItem which is added to the BuildNavigation event object has a number of members available for assignment:

$key

The key is used to uniquely identify the item within the navigation structure. Additionally, the key defines the navigation menu structure, using dots to define each level of navigation. When the navigation structure is built, the navigation menu structure will be generated based on these dots.

$label

The label is the text that you would like to show the user for the menu item. Note that this is just another member, so you may set it to numbers, class instances, ..., if you wish, however if a label is not specified it will default to the value of the key at the current depth.

$href

This is where you would like the menu item to link to. Again, it's just another member, so you can put whatever you want in here, however a URL is usually a good choice.

$sortIndex

Specify an integer or float to sort the order of the menu items. Note that because the result of building a menu is an associative array, the sort index is simply passed along to the resulting associative array as a key-value pair, and must be handled by the menu renderer if it's required.

$right

A boolean flag to indicate that this menu item should appear right-aligned. Again, you can use this member for whatever you would like, however many menu rendering systems (like bootstrap and semantic-ui) allow for right-aligned menu items, so this can be helpful for that.

Author

Daniel 'Vector' Kerr [email protected]


All versions of laravel-navigation with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/support Version 5.4.*
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 vector88/laravel-navigation contains the following files

Loading the files please wait ....