All Projects → lukesnowden → menu

lukesnowden / menu

Licence: other
Simplistic, effortless menu building API originally built for Laravel use, now a seamlessly independent package.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to menu

django-menu-generator
A straightforward menu generator for Django
Stars: ✭ 24 (+71.43%)
Mutual labels:  menu, menu-generator
menutray
An application menu through a GTK+ tray status icon.
Stars: ✭ 62 (+342.86%)
Mutual labels:  menu, menu-generator
MYNavigationController
导航控制器的压缩 , 使得可以将导航范围缩小到指定区域 , 实现页面中的页面效果 . 适用于路径选择,文件选择等
Stars: ✭ 47 (+235.71%)
Mutual labels:  menu
Nova-Menu-Builder
A Menu Builder for Laravel Nova
Stars: ✭ 63 (+350%)
Mutual labels:  menu
guillotine
Guillotine is a gnome extension designed for efficiently carrying out executions of commands from a customizable menu. Simply speaking: it is a highly customizable menu that enables you to launch commands and toggle services.
Stars: ✭ 28 (+100%)
Mutual labels:  menu
priority-plus
A modern implementation of the priority plus navigation pattern.
Stars: ✭ 30 (+114.29%)
Mutual labels:  menu
selectr
✅ The coolest jQuery select plugin you've never seen
Stars: ✭ 19 (+35.71%)
Mutual labels:  menu
Menu
The most customizable menu for macOS apps.
Stars: ✭ 84 (+500%)
Mutual labels:  menu
simple-sidenav
Simple, easily customizable, animated menu.
Stars: ✭ 40 (+185.71%)
Mutual labels:  menu
ElDewrito-Menu
Possible replacement for Halo Online's UI heavily based on Halo: Reach
Stars: ✭ 22 (+57.14%)
Mutual labels:  menu
PopOverAlert
PopOverAlert is a PopOver style alert view.
Stars: ✭ 56 (+300%)
Mutual labels:  menu
go-telegram-flow
Go Telegram Flow is a set of tools that may assist bot developers
Stars: ✭ 28 (+100%)
Mutual labels:  menu
react-native-panel
A Customizable React Native Panel for Android and iOS
Stars: ✭ 35 (+150%)
Mutual labels:  menu
unity circle menu
Circle Menu is a C# script used in Unity to quickly and easily create GUI circular menus, a great way to add intuitive and ergonomic menus to your applications and games.
Stars: ✭ 44 (+214.29%)
Mutual labels:  menu
menu-bundle
Extends the KnpMenuBundle to work with PHPCR ODM
Stars: ✭ 32 (+128.57%)
Mutual labels:  menu
TheBashMenu
A useful bash script allowing you to easily create your own menu, which uses the directional keys! Quickly add your title, options and commands and you're good to go!
Stars: ✭ 52 (+271.43%)
Mutual labels:  menu
menu-hamburger
🍔 A clean, simple and easy to use library to create a Menu Hamburger
Stars: ✭ 17 (+21.43%)
Mutual labels:  menu
navbar.js
Modern Navigation Component
Stars: ✭ 47 (+235.71%)
Mutual labels:  menu
LavaFab
💧 Android floating action button menu with "lava" animation
Stars: ✭ 51 (+264.29%)
Mutual labels:  menu
apporder
Nextcloud app to enable sorting inside the app menu
Stars: ✭ 30 (+114.29%)
Mutual labels:  menu

lukesnowden/menu

http://luke.sno.wden.co.uk/menu for more information and for feature requests.

Usage

Very simple method of building menus from database data (id, parent id), service provider register methods for application modules and much more.

Standalone

use LukeSnowden\Menu\Menu;
include __DIR__ . '/vendor/autoload.php';

Example 1

<?php
Menu::addItem( array( 'text' => 'Home', 'URL' => '/', 'reference' => '0' ) );
echo Menu::render();
?>

##Example 2 - Nesting Children

<?php
Menu::addItem( array( 'text' => 'Services', 'URL' => '/services/', 'reference' => '1', 'parent' => '0' ) );
echo Menu::render();
?>

Example 3 - Multiple Menus

<?php
Menu::addItem( array( 'text' => 'Services', 'URL' => '/services/', 'reference' => '1', 'parent' => '0' ) )->toMenu( 'main' );
echo Menu::render( 'main' );
?>

Auto classes

I have added in some of the most used and required classes for styling menus

.first-item {}
.last-item {}
.current-root {}
.current-parent {}
.current-ancestor {}
.has-children {}

Output

<?php
Menu::addItem( array( 'text' => 'Home', 'URL' => '/menu-test-2/public/', 'reference' => '1', 'class' => 'home-icon', 'weight' => 0 ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Services', 'URL' => '/menu-test-2/public/services/', 'reference' => '2' ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Development', 'URL' => '/menu-test-2/public/services/development/', 'reference' => '3', 'parent' => '2' ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Design', 'URL' => '/menu-test-2/public/services/design/', 'reference' => '4', 'parent' => '2', 'weight' => 0 ) )->toMenu( 'main' );
echo Menu::render( 'main' );
?>
<ul class="nav-main">
    <li class="home-icon current first-item container node-1">
        <a href="/menu-test-2/public/">Home</a>
    </li>
    <li class=" has-children last-item container node-1">
        <a href="/menu-test-2/public/services/">Services</a>
        <ul>
            <li class=" first-item nav-node node-2">
                <a href="/menu-test-2/public/services/design/">Design</a>
            </li>
            <li class=" last-item nav-node node-2">
                <a href="/menu-test-2/public/services/development/">Development</a>
            </li>
        </ul>
    </li>
</ul>

Custom attributes

$name = false, $attributes = array(), $htmlTag = 'ul'

echo Menu::render( 'main', array( 'class' => 'nav nav-pills nav-stacked', 'role' => 'tablist' ), 'nav' );

Custom Layout Render

You may want to change the output layout (demo render class included)

Menu::addItem( array( 'text' => 'Home', 'URL' => '/menu-test-2/public/', 'reference' => '1', 'class' => 'home-icon', 'weight' => 0 ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Services', 'URL' => '/menu-test-2/public/services/', 'reference' => '2' ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Development', 'URL' => '/menu-test-2/public/services/development/', 'reference' => '3', 'parent' => '2' ) )->toMenu( 'main' );
Menu::addItem( array( 'text' => 'Design', 'URL' => '/menu-test-2/public/services/design/', 'reference' => '4', 'parent' => '2', 'weight' => 0 ) )->toMenu( 'main' );

Menu::setMenuType( 'horizontal', 'main', 'LukeSnowden\Menu\Styles' );
echo Menu::render( 'main' );

Use with third party menu UI through L4 Model

(Please note this is just a general summary of how it would work if you had 2 tables (and models) for navigations and navigation items with a standard hasMany() relationship)

<?php
$navigation = Navigation::with( 'navigationItems' )->where( 'navigation_slug', '=', 'main' )->get();
foreach( $navigation->navigationItems as $item )
{
    Menu::addItem( array( 'text' => , $item->name 'URL' => $item->url, 'reference' => $item->id, 'parent' => $item->parent_id, 'weight' => $item->order ) )->toMenu( $navigation->navigation_slug );
}
echo Menu::render( $navigation->navigation_slug );
?>

Laravel Install

Add the following to you applications composer.json file

composer require lukesnowden/menu:dev-master

add the following to your /app/config/app.php's provider array.

'LukeSnowden\Menu\MenuServiceProvider'

add the following to your /app/config/app.php's aliases array.

'Menu'      => 'LukeSnowden\Menu\Facades\Menu'

and finally back to your terminal and run

php composer.phar dump-autoload
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].