moonshine/multi-panels
Composer 安装命令:
composer require moonshine/multi-panels
包简介
Multi panels for MoonShine
README 文档
README
MoonShine Multi-Panels
⚠️ EXPERIMENTAL BETA VERSION
This package is under active development. API may change in future versions.
Package for creating multiple admin panels in one MoonShine application with independent settings, routes and interfaces.
Requirements
- MoonShine 4.4+
- Laravel 10+
- PHP 8.2+
Installation
composer require moonshine/multi-panels
Configuration
1. Disable default MoonShine routes
Open config/moonshine.php and set:
'use_routes' => false,
2. Add MultiPanelMiddleware
IMPORTANT: Add MultiPanelMiddleware to the middleware configuration. You can add it at the top-level (for all panels) or to specific panels.
Option 1: Add to all panels (recommended)
// config/moonshine.php 'middleware' => [ // ... other middleware \MoonShine\MultiPanels\Http\Middleware\MultiPanelMiddleware::class, ],
Option 2: Add to specific panels only
// config/moonshine.php 'panels' => [ 'admin' => [ 'prefix' => 'admin', 'middleware' => [ 'moonshine', \MoonShine\MultiPanels\Http\Middleware\MultiPanelMiddleware::class, ], ], 'test' => [ 'prefix' => 'test', 'middleware' => [ 'moonshine', \MoonShine\MultiPanels\Http\Middleware\MultiPanelMiddleware::class, ], ], ],
3. Configure panels
In the same config/moonshine.php file add panels section:
'panels' => [ 'admin' => [ 'prefix' => '', 'title' => 'Admin panel', ], 'test' => [ 'prefix' => 'test', 'title' => 'Test panel', 'palette' => SkyPalette::class, // 'layout' => AppLayout::class, ], ],
Panel configuration structure
Each panel is a key in the panels array, where:
- Key - unique panel identifier (e.g.,
admin,test) - Value - array of panel settings
Available panel settings
Inside a panel you can override any parameter from the top-level MoonShine configuration:
'panels' => [ 'admin' => [ 'prefix' => '', // URL prefix (optional) 'title' => 'Admin Panel', // Panel title 'layout' => AdminLayout::class, // Custom layout 'palette' => BluePalette::class, // Color scheme 'logo' => '/images/admin-logo.png', 'logo_small' => '/images/admin-logo-small.png', // ... any other settings from moonshine.php ], 'client' => [ 'prefix' => 'client', 'title' => 'Client Area', 'layout' => ClientLayout::class, 'palette' => GreenPalette::class, // ... settings for client panel ], ],
Important:
- If a parameter is not specified in the panel, the default value from the top-level configuration is used
- If
prefixis not specified, the panel key is used as the prefix - You can set
prefix => ''for a panel without prefix (root URL)
Usage
Binding resources to a panel
To make a resource appear only in a specific panel, extend MultiPanelResource and specify the $panel property:
<?php namespace App\MoonShine\Resources; use MoonShine\MultiPanels\MultiPanelResource; class CarResource extends MultiPanelResource { protected string $panel = 'test'; // ... rest of the resource code }
Binding pages to a panel
Similarly for pages, use MultiPanelPage:
<?php namespace App\MoonShine\Pages; use MoonShine\MultiPanels\MultiPanelPage; class Components extends MultiPanelPage { protected string $panel = 'test'; // ... rest of the page code }
Custom layouts
You can create a unique layout for each panel:
- Create a custom Layout class:
<?php namespace App\MoonShine\Layouts; use MoonShine\Laravel\Layouts\AppLayout; class ClientLayout extends AppLayout { protected function getMenu(): array { return [ // Your custom menu for client panel ]; } }
- Specify it in the panel configuration:
'panels' => [ 'client' => [ 'prefix' => 'client', 'layout' => ClientLayout::class, // ... ], ],
Usage examples
Example 1: Admin panel and client panel
// config/moonshine.php 'panels' => [ 'admin' => [ 'prefix' => 'admin', 'title' => 'Admin Panel', 'layout' => AdminLayout::class, 'palette' => BluePalette::class, ], 'client' => [ 'prefix' => 'client', 'title' => 'Client Area', 'layout' => ClientLayout::class, 'palette' => GreenPalette::class, ], ],
URLs:
https://yourdomain.com/admin- admin panelhttps://yourdomain.com/client- client panel
Example 2: Multiple admin panels with different permissions
'panels' => [ 'superadmin' => [ 'prefix' => '', // root URL 'title' => 'Super Admin', 'palette' => RedPalette::class, ], 'manager' => [ 'prefix' => 'manager', 'title' => 'Manager Panel', 'palette' => OrangePalette::class, ], 'support' => [ 'prefix' => 'support', 'title' => 'Support Panel', 'palette' => BluePalette::class, ], ],
How it works
- Each panel works as an independent MoonShine application
- Resources and pages are bound to a specific panel via the
$panelproperty - Panel configuration overrides global MoonShine settings
- Routes are built automatically based on the panel prefix
- The
MultiPanelMiddlewaredetermines the current panel and applies its settings
Service Provider Registration
If not registered automatically, add MultiPanelServiceProvider in bootstrap/providers.php:
return [ App\Providers\AppServiceProvider::class, MoonShine\MultiPanels\Providers\MultiPanelServiceProvider::class, ],
moonshine/multi-panels 适用场景与选型建议
moonshine/multi-panels 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 4, 最近一次更新时间为 2026 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「multi-tenant」 「tenancy」 「moonshine」 「multi-panels」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moonshine/multi-panels 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moonshine/multi-panels 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moonshine/multi-panels 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The tenancy/tenancy views mutations
The tenancy/tenancy logs mutations
The tenancy/tenancy identification driver using environment variables
The tenancy/tenancy cache mutations
The tenancy/tenancy database driver for sqlite
User permissions for MoonShine
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-08