caydeesoft/menu-manager
Composer 安装命令:
composer require caydeesoft/menu-manager
包简介
Config-driven Laravel menu manager for Blade sidebar navigation, top menus, dropdowns, and permission-aware links.
关键字:
README 文档
README
Config-driven Laravel menu manager for Blade sidebar navigation, top menus, dropdown menus, and permission-aware admin panel links.
Menu Manager lets you define Laravel navigation menus in one config file and
render them with one reusable Blade view. Configure menu items, named routes,
route parameters, HTML tags, CSS classes, Font Awesome icons, dropdowns, and
Spatie permission checks from config/menu-manager.php.
Features
- Config-driven Laravel sidebar and top navigation menus.
- One reusable Blade renderer for multiple menu locations.
- Permission-aware links using Laravel authorization and Spatie permissions.
- Dropdown menu support with configurable wrapper, toggle, and child classes.
- Route parameters, icons, custom attributes, active classes, and raw HTML items.
- Publishable config and views for Laravel admin panels and dashboards.
Install
composer require caydeesoft/menu-manager
Publish the config:
php artisan vendor:publish --tag=menu-manager-config
Menu Location
After publishing, configure all menus here:
config/menu-manager.php
Package source config:
vendor/caydeesoft/menu-manager/src/config/menu-manager.php
Direct package development config:
src/config/menu-manager.php
Config Structure
Each menu has a view section and an items section:
return [ 'menus' => [ 'sidebar' => [ 'view' => [ 'wrapper' => [ 'tag' => 'ul', 'class' => 'sidebar-nav', 'attributes' => [ 'role' => 'list', ], ], 'header' => [ 'tag' => 'li', 'class' => 'sidebar-header', 'attributes' => [ 'role' => 'presentation', ], ], 'item' => [ 'tag' => 'li', 'class' => 'sidebar-item', 'active_class' => 'active', ], 'link' => [ 'class' => 'sidebar-link', ], 'icon' => [ 'tag' => 'i', 'class' => 'align-middle', ], 'label' => [ 'tag' => 'span', 'class' => 'align-middle', ], ], 'items' => [ [ 'type' => 'header', 'title' => 'Main', 'position' => 1, ], [ 'type' => 'item', 'title' => 'Dashboard', 'route' => 'backend.admin_dashboard', 'icon' => 'fas fa-home', 'position' => 2, ], ], ], ], ];
That renders:
<ul class="sidebar-nav" role="list"> <li class="sidebar-header" role="presentation">Main</li> <li class="sidebar-item"> <a href="{{ route('backend.admin_dashboard') }}" class="sidebar-link"> <i class="fas fa-home align-middle"></i> <span class="align-middle">Dashboard</span> </a> </li> </ul>
Rendering
Use the generic renderer for any configured menu:
@include('menu-manager::menu', ['menu' => 'sidebar'])
Convenience aliases are also available:
@include('menu-manager::sidebar') @include('menu-manager::top')
Both aliases use the same generic Blade renderer internally.
Item Types
Header
[
'type' => 'header',
'title' => 'Revenue',
'position' => 20,
],
Item
[
'type' => 'item',
'title' => 'Transactions',
'route' => 'backend.transaction.index',
'icon' => 'fas fa-dollar-sign',
'permission' => 'view_transaction',
'position' => 22,
],
Item With Route Params
[
'type' => 'item',
'title' => 'Activity Log',
'route' => 'backend.logs.index',
'params' => [
'user' => 1,
],
'icon' => 'fas fa-pen',
'position' => 41,
],
Dropdown
[
'type' => 'dropdown',
'title' => 'Settings',
'icon' => 'fas fa-tools',
'permission' => 'view_settings',
'position' => 50,
'children' => [
[
'type' => 'item',
'title' => 'General',
'route' => 'backend.settings.general',
'permission' => 'view_settings',
'position' => 1,
],
],
],
Configure dropdown HTML in the menu view section:
'dropdown' => [ 'tag' => 'li', 'class' => 'sidebar-item', 'toggle' => [ 'class' => 'sidebar-link collapsed', 'attributes' => [ 'data-bs-toggle' => 'collapse', 'aria-expanded' => 'false', ], ], 'children' => [ 'tag' => 'ul', 'class' => 'sidebar-dropdown list-unstyled collapse', 'attributes' => [ 'role' => 'list', ], ], ],
Raw HTML
Use html for special menu entries that do not fit the standard item shape:
[
'type' => 'html',
'html' => '<li class="nav-item"><button type="button" class="btn btn-theme-toggle">Light</button></li>',
'position' => 1,
],
Per-Item Classes And Attributes
You can override classes on any item:
[
'type' => 'item',
'title' => 'Dashboard',
'route' => 'backend.admin_dashboard',
'icon' => 'fas fa-home',
'item_class' => 'sidebar-item custom-item',
'link_class' => 'sidebar-link custom-link',
'icon_class' => 'align-middle text-primary',
'label_class' => 'align-middle fw-bold',
'link_attributes' => [
'data-turbo' => 'false',
],
'position' => 2,
],
Permissions
The menu is built only for authenticated users.
permissionshows the entry when the user has that permission.permissionsshows the entry when the user has at least one listed permission.- Entries without
permissionorpermissionsare visible to any authenticated user.
Dropdown children are filtered by permission too.
Sorting
Items are sorted by position in ascending order.
Views
Publish views only if you need to change the renderer itself:
php artisan vendor:publish --tag=menu-manager-views
Published views:
resources/views/vendor/menu-manager/menu.blade.php
resources/views/vendor/menu-manager/sidebar.blade.php
resources/views/vendor/menu-manager/top.blade.php
resources/views/vendor/menu-manager/partials/items.blade.php
resources/views/vendor/menu-manager/partials/attributes.blade.php
Releases
Releases are documented automatically by GitHub Actions when a semantic version tag is pushed:
git tag v1.0.0 git push origin v1.0.0
The release workflow validates Composer, installs dependencies, runs PHPUnit, and creates a GitHub release with generated release notes.
Update CHANGELOG.md before tagging.
MCP Compatibility
This package is a Laravel Composer package, not a Model Context Protocol server.
It includes MCP.md and llms.txt for AI/agent-friendly project metadata, but
it does not publish an MCP server.json because it does not expose MCP tools,
resources, prompts, or transport.
caydeesoft/menu-manager 适用场景与选型建议
caydeesoft/menu-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「navigation」 「laravel」 「permission」 「admin-panel」 「sidebar」 「blade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 caydeesoft/menu-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 caydeesoft/menu-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 caydeesoft/menu-manager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A block to display a list of links to child pages, or pages in current level
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
This package provides a flexible way to add Role-based Permissions to Laravel
Laravel Menu management
Alfabank REST API integration
Create simple top navigation for laravel
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 60
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-14