mkdesignn/menubuilder
Composer 安装命令:
composer require mkdesignn/menubuilder
包简介
menu builder is a package which can make you a menu by the input config
README 文档
README
dynamic menu builder is a quick and easy way to create your menu. I'v always wanted a way to generate a menu without recreating everything from the Base.
note, vue.js ver2 will needed for this project.
Usage
Step 1: install it through composer
composer require mkdesignn/menubuilder
Step 2: Add the Service Provider
Mkdesignn\MenuBuilder\MenuProvider::class
Step 2: Add Facade class
'Menu' => Mkdesignn\MenuBuilder\Facade::class
Step 3: publish the vendor files
PHP artisan vendor: publish
above command will publish menu folder which contains two files, index.js and style.css which both of them should be included and also this command will publish menu.php config file.
Examples
Create simple menu
echo Menu::render('vertical', new \App\Tag(), "vertical-menu");
this way we can build simple menu, as you can see render method takes 3 arguments which I describe each of them in the below.
first argument
the first argument Is the type of the menu which wants to be created. it could be vertical or horizontal.
second argument
the second argument is the table which we need to use it as a source.
The class that pass to the render method should be extended model abstract class
the table tag that has been passed to the render method has the below structure
| id | parent_id | name | slug | bg_color | bg_hover_color | text_color | text_hover_color |
|---|---|---|---|---|---|---|---|
| 1 | 0 | Php | Php | ||||
| 2 | 0 | Javascript | Javascript | ||||
| 3 | 2 | JQuery | JQuery | ||||
| 4 | 2 | Vue.js | Vue.js | ||||
| 5 | 2 | Node.js | Node.js | ||||
| 5 | 1 | Laravel | Laravel | ||||
| 5 | 1 | Symphony | Symphony | ||||
| 5 | 5 | Npm | Npm | ||||
| 5 | 4 | Vuex | Vuex |
as you can see in the above grid there are a bunch of fields but there are some that are not necessary to use like the bg_color, bg_hover_color, text_color, text_hover_color, but you can use each of them. this way the menu look likes much more dynamically. the field parent_id should remain parent_id .
third argument
The third argument passed to the render method, it's a class selector which we can use it to add some CSS style to the menu. If no class passed then mk_menu will be using as the default class.
fourth argument
we have the fourth argument which we can use it as configuration, the fourth argument should be an array and it'll be using for the configuration.
some of the examples
echo Menu::render('vertical', new \App\Tag(), "test");
mkdesignn/menubuilder 适用场景与选型建议
mkdesignn/menubuilder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 55 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 06 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mkdesignn/menubuilder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mkdesignn/menubuilder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2017-06-22