承接 gourmet/knp-menu 相关项目开发

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

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

gourmet/knp-menu

最新稳定版本:v0.5.0

Composer 安装命令:

composer require gourmet/knp-menu

包简介

KnpMenu for CakePHP 3

README 文档

README

Build Status Total Downloads License

Use KnpMenu with CakePHP 3.

What's included?

  • MenuComponent
  • MenuHelper

Install

Using Composer:

composer require gourmet/knp-menu:~0.4

You then need to load the plugin. In boostrap.php, something like:

\Cake\Core\Plugin::load('Gourmet/KnpMenu');

and add the following to your App\Controller\AppController:

public $components = ['Gourmet/KnpMenu.Menu'];
public $helpers = ['Gourmet/KnpMenu.Menu'];

Usage

It's fairly simple. The concept is you get a menu, and you addChild to it from anywhere at anytime at the controller or view layer. At the view layer, you can also render any defined menu.

Get a menu

$menu = $this->Menu->get('my_menu');

Add child to menu

// using an array for URL and child's name as title
$menu->addChild('Dashboard', ['uri' => ['controller' => 'Users', 'action' => 'dashboard']]);
// using a named route for URL and custom title
$menu->addChild('Dashboard', ['route' => 'dashboard', 'label' => 'My Account']);

Render a menu

Only available at the view layer

// by default, renders as a list
echo $this->Menu->render('my_menu');

Of course, you can set your own renderer (defaults to \Gourmet\KnpMenu\Menu\Renderer\ListRenderer) and matcher (defaults to \Gourmet\KnpMenu\Menu\Matcher\Matcher) by passing them as options:

echo $this->Menu->render('my_menu', [
    'matcher' => '\Custom\Matcher',
    'renderer' => new \Custom\Renderer(...)
]);

For more, please check the official KnpMenu repo and documentation.

Patches & Features

  • Fork
  • Mod, fix
  • Test - this is important, so it's not unintentionally broken
  • Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
  • Pull request - bonus point for topic branches

Bugs & Feedback

http://github.com/gourmet/knp-menu/issues

License

Copyright (c) 2015, Jad Bitar and licensed under The MIT License.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-25