Download the PHP package tlr/menu without Composer

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

Menu Builder

An attempt to take a bit of the stress and boilerplate out of building menus (or indeed any list, because that's basically what a menu is) Comes with support for Laravel 4 (other frameworks to follow)

Framework Integrations:

Installation

Simply require the library like so:

`

Basic Usage

Make a new MenuItem class for your menu:

Add some menu items:

Why not add a sub-menu? The menu, and all of its items are all the same MenuItem class, so creating submenus is the same as with top level menus:

Then in you view, you can iterate over the menu's items using the $menu->getItems() method.

You can retreive an existing item by using its key:

The method signature is as follows:

Managing Multiple Menus

If you have, say, a header and a footer menu, you can use the MenuRepository class:

and you can retrieve the menu later in your code in the same way:

Filters

The menu can be filtered. Say you have a menu for usage in an admin area, or in a context with user auth levels or permissions. You have two options:

Activating

To mark menu items as active, you have a few options:

Say you have this 2 level menu:

Manual Activation

You can manually activate any of those items with the setActive method:

URL Matching

For a more automated approach, you can recursively mark one of those as activated based on the current URL. For example:

This would match the given url against each of the menu's items, and mark them as active if the url matches. It also calls each item's children, and marks the parents as active if they have an active child item. ie. activeness bubbles up the chain.

So, if the current URL was http://foo.com/contact-us, this would mark the about menu item, and its child item, contact as active.

Advanced

If you want to match based on something different than URL, you can match against anything in a MenuItem's options array:

Laravel

Add Tlr\Menu\Laravel\MenuServiceProvider to the providers array in Laravel's config/app.php's, and add 'Menu' => 'Tlr\Menu\Laravel\MenuFacade' to the aliases array.

You can then use the Menu facade as a shortcut for the MenuRepository class, like so:

after which, you can access it again later with Menu::menu( 'nav' ).

The Laravel version of the class can be echoed out (which will call the render() method). This renders the menu using Laravel's blade templating system. You have two options for customising:


All versions of menu with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version ~5.0
patchwork/utf8 Version 1.1.*
laravelcollective/html Version ~5.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 tlr/menu contains the following files

Loading the files please wait ....