承接 anlutro/menu 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anlutro/menu

Composer 安装命令:

composer require anlutro/menu

包简介

Dynamic menu builder.

README 文档

README

Simple dynamic menu building system.

PHP framework agnostic. The default renderer uses Bootstrap 3 class names and markup.

Installation

composer require anlutro/menu - pick the latest tag visible in the github tag list or on packagist.

Laravel 4

Add anlutro\Menu\ServiceProvider to the list of providers in app/config/app.php. Optionally, add an alias for 'Menu' => 'anlutro\Menu\Facade' as well. The menu builder instance can be accessed via the facade or via automatic dependency injection by type hinting.

Do artisan config:publish anlutro/menu to change the default Bootstrap 3-specific settings.

Usage

Set up a shared instance of Menu\Builder. Create the menus you need.

$builder = new anlutro\Menu\Builder;
$menu = $builder->createMenu('left');

If you're using Laravel 4, you can use Menu:: instead of $builder-> provided you set up an alias as shown in the installation instructions above.

From here, you can add items to your menus from anywhere.

$menu->addItem('Item 1', '/my-uri');

// you can add custom html attributes to your items
$menu->addItem('Item 2', '/my-uri', ['class' => 'custom-class']);

// use priorities to push items to the top or bottom of your menu
// items have priority 0 by default.
$menu->addItem('First item', '/my-uri', [], -50);
$menu->addItem('Last item', '/my-uri', [], 50);

Adding submenus works similarly.

$submenu = $menu->addSubmenu('Sub Menu');
$submenu->addItem('Sub item 1', '/my-uri');

When you want to render a menu, call render($menu) and echo it.

echo $builder->render('left');

By default, Bootstrap 3-specific classes are used. If you want to use something else, you need to create your own class implementation of anlutro\Menu\Renderers\RendererInterface and either do $builder->setDefaultRenderer('MyRenderer') or $builder->render('name_of_menu', $myRenderer).

Contact

Open an issue on GitHub if you have any problems or suggestions.

License

The contents of this repository is released under the MIT license.

统计信息

  • 总下载量: 1.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 19
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固