Download the PHP package happydemon/elements without Composer

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

HTML Navigation Module for Kohana 3.3

Simplify rendering, building and maintenance of simple, dynamic standardised navigation menus and breadcrumbs. Instead of ...

... we do this:

As you can see the first item uses an url property, as the original Kohana-menu module required, while the second item uses a route property.

The route property was added to make use of Kohana's own routing system and use reverse routing, making it easier to check if the link is currently active.

I do recomend defining routes for every controller's action you have in your project.

Installation

Place the files in your modules directory.

As a Git submodule:

As a Composer dependency

Copy MODPATH.elements/config/navigation/navbar.php into APPPATH/config/navigation/navbar.php and customize

Activate the module in bootstrap.php.

Example use case

A WordPress type blog might have...

Normally, you'd build HTML views with ul and li elements and then write some PHP to highlight the active link. This is difficult to maintain (DRY) and too much hassle (not to mention ugly).

Instead, describe your (standardised) menus in configuration files and have Kohana do the heavy lifting.

The same goes for breadcrumbs, you might need them for:

and could have the same structure you'd use for your menu's

What this fork offers over Kohana-menu

Kohana-menu has a specific job and does it well, I personally also needed a way to manage my breadcrumbs for certain areas of the site.

Since my breadcrumbs contain the same data structure as my menu's (and many could share 1 config file), I decided to expand on this module so I could use it for both ends.

Basics

You define your menus in Kohana configuration files (see config/navigation/navbar.php). Then, in your (main) controller (or template), you construct a new Element object, set the active link and render it in your template. Done.

Echo menu output in your template (using the included twitter bootstrap template)

and output the breadcrumb wherever you want (we'll use the bootstrap styling)

You might wish to instantiate the menu in your main controller, since this gives you a way to interact with the Element object before it's rendered.

Config files

You can use different config files by setting the factory's $config parameter.

Example: Load menu configuration based on user role

Marking the current menu item

Use set_current() to mark the current menu item in your controller if you're not making use of routes

The parameter of set_current() is the URL value of the respective item or its (numeric) array key.

However, if you've defined a 'route' property in the item it can be auto-detected if you define all your routes using Route::set in your bootstrap.php or init.php's

Hard-set the active breadcrumb item

On certain pages you'd like to show a dynamic active breadcrumb item (the last one down the tree) to clearify which action if being done.

You can do this by calling last_item on your Element object and defining what you'd want to be rendered instead of the default text that was defined in your config file:

Documentation

The code is mostly commented, a user guide is on it's way with more examples.

Licence

The Kohana module started out as a fork of Anroot's Kohana-menu, which in turn is a fork of the original Kohana Menu module by Bastian Bräu, but is now independently developed under the MIT licence.

Gittip Badge


All versions of elements with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
composer/installers Version *
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 happydemon/elements contains the following files

Loading the files please wait ....