harimayco/laravel-menu
最新稳定版本:1.4.5
Composer 安装命令:
composer require harimayco/laravel-menu
包简介
drag and drop menu generator like wordpress for laravel 5
关键字:
README 文档
README
*This package is abandoned: I'm not maintaining this package anymore, please contact me if you want to take over this project or feel free to fork and make your own. Thank you
forked from https://github.com/lordmacu/wmenu 
Installation
- Run
composer require harimayco/laravel-menu Step 2 & 3 are optional if you are using laravel 5.5
- Add the following class, to "providers" array in the file config/app.php (optional on laravel 5.5)
Harimayco\Menu\MenuServiceProvider::class,
- add facade in the file config/app.php (optional on laravel 5.5)
'Menu' => Harimayco\Menu\Facades\Menu::class,
- Run publish
php artisan vendor:publish --provider="Harimayco\Menu\MenuServiceProvider" - Configure (optional) in config/menu.php :
- CUSTOM MIDDLEWARE: You can add you own middleware
- TABLE PREFIX: By default this package will create 2 new tables named "menus" and "menu_items" but you can still add your own table prefix avoiding conflict with existing table
- TABLE NAMES If you want use specific name of tables you have to modify that and the migrations
- Custom routes If you want to edit the route path you can edit the field
- Role Access If you want to enable roles (permissions) on menu items
- Run migrate
php artisan migrate
DONE
Menu Builder Usage Example - displays the builder
On your view blade file
@extends('app') @section('contents') {!! Menu::render() !!} @endsection //YOU MUST HAVE JQUERY LOADED BEFORE menu scripts @push('scripts') {!! Menu::scripts() !!} @endpush
Using The Model
Call the model class
use Harimayco\Menu\Models\Menus; use Harimayco\Menu\Models\MenuItems;
Menu Usage Example (a)
A basic two-level menu can be displayed in your blade template
Using Model Class
/* get menu by id*/ $menu = Menus::find(1); /* or by name */ $menu = Menus::where('name','Test Menu')->first(); /* or get menu by name and the items with EAGER LOADING (RECOMENDED for better performance and less query call)*/ $menu = Menus::where('name','Test Menu')->with('items')->first(); /*or by id */ $menu = Menus::where('id', 1)->with('items')->first(); //you can access by model result $public_menu = $menu->items; //or you can convert it to array $public_menu = $menu->items->toArray();
or Using helper
// Using Helper $public_menu = Menu::getByName('Public'); //return array
Menu Usage Example (b)
Now inside your blade template file place the menu using this simple example
<div class="nav-wrap"> <div class="btn-menu"> <span></span> </div><!-- //mobile menu button --> <nav id="mainnav" class="mainnav"> @if($public_menu) <ul class="menu"> @foreach($public_menu as $menu) <li class=""> <a href="{{ $menu['link'] }}" title="">{{ $menu['label'] }}</a> @if( $menu['child'] ) <ul class="sub-menu"> @foreach( $menu['child'] as $child ) <li class=""><a href="{{ $child['link'] }}" title="">{{ $child['label'] }}</a></li> @endforeach </ul><!-- /.sub-menu --> @endif </li> @endforeach @endif </ul><!-- /.menu --> </nav><!-- /#mainnav --> </div><!-- /.nav-wrap -->
HELPERS
Get Menu Items By Menu ID
use Harimayco\Menu\Facades\Menu; ... /* Parameter: Menu ID Return: Array */ $menuList = Menu::get(1);
Get Menu Items By Menu Name
In this example, you must have a menu named Admin
use Harimayco\Menu\Facades\Menu; ... /* Parameter: Menu ID Return: Array */ $menuList = Menu::getByName('Admin');
Customization
you can edit the menu interface in resources/views/vendor/wmenu/menu-html.blade.php
Credits
- wmenu laravel package menu like wordpress
Compatibility
- Tested with laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.x, 7.x
KNOWN ISSUES
- Not working with RTL websites #21 (pull requests are welcome)
harimayco/laravel-menu 适用场景与选型建议
harimayco/laravel-menu 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 71.82k 次下载、GitHub Stars 达 171, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「menu」 「wordpress」 「builder」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 harimayco/laravel-menu 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 harimayco/laravel-menu 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 harimayco/laravel-menu 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony extension to get active class base on current bundle/controller/action
A Sphinx Query Builder extension for the Laravel Database package
Anax Database Active Record module for model classes.
A simple package to create tables in Discord messages.
Create mail from controller action render
Yii2 DynaTree Menu widget uses Dynamic tree view control jquery.dynatree.js
统计信息
- 总下载量: 71.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 174
- 点击次数: 17
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-01-04