定制 laravilt/panel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

laravilt/panel

Composer 安装命令:

composer require laravilt/panel

包简介

A powerful admin panel framework for Laravel with Vue.js (Inertia.js) frontend. Build beautiful, reactive admin panels with minimal effort.

README 文档

README

Panel

Laravilt Panel

Latest Stable Version License Downloads Dependabot Updates PHP Code Styling Tests

A powerful admin panel framework for Laravel with Vue.js (Inertia.js) frontend. Build beautiful, reactive admin panels with minimal effort.

Features

  • Resources: Auto-generate CRUD interfaces from database tables
  • Pages: Custom standalone pages with full control
  • Clusters: Group related pages under a common navigation section
  • API Generation: RESTful API endpoints with interactive API Tester
  • Forms: Dynamic form builder with 30+ field types
  • Tables: Feature-rich data tables with filtering, sorting, and bulk actions
  • Infolists: Display record details in elegant layouts
  • Actions: Customizable actions with modal support
  • Navigation: Auto-generated navigation with groups and badges
  • Multi-Tenancy: Single-database or multi-database SaaS architecture

Installation

composer require laravilt/panel

The package will automatically register its service provider.

Configuration

Publish the config file:

php artisan vendor:publish --tag="laravilt-panel-config"

Quick Start

1. Create a Panel

php artisan laravilt:panel admin

This creates a new admin panel at app/Providers/Laravilt/AdminPanelProvider.php.

2. Create a Resource

php artisan laravilt:resource admin

Follow the interactive prompts to:

  • Select a database table
  • Choose which columns to include
  • Enable API endpoints (optional)
  • Enable API Tester interface (optional)

3. Create a Page

php artisan laravilt:page admin Dashboard

Creates a standalone page with both PHP controller and Vue component.

4. Create a Cluster

php artisan laravilt:cluster admin Settings --icon=Settings

Creates a cluster to group related pages:

// app/Laravilt/Admin/Clusters/Settings.php
class Settings extends Cluster
{
    protected static ?string $navigationIcon = 'Settings';
    protected static ?string $navigationLabel = 'Settings';
}

Assign pages to a cluster:

class ProfilePage extends Page
{
    protected static ?string $cluster = Settings::class;
}

API Generation

Resources can automatically generate RESTful API endpoints.

Enable API on a Resource

Simply define an api() method on your resource - the API will be auto-detected:

class ProductResource extends Resource
{
    public static function api(ApiResource $api): ApiResource
    {
        return ProductApi::configure($api);
    }
}

API Configuration Class

class ProductApi
{
    public static function configure(ApiResource $api): ApiResource
    {
        return $api
            ->columns([
                ApiColumn::make('id')->type('integer')->sortable(),
                ApiColumn::make('name')->searchable()->sortable(),
                ApiColumn::make('price')->type('decimal'),
                ApiColumn::make('created_at')->type('datetime'),
            ])
            ->useAPITester(); // Enable interactive API tester UI
    }
}

API Tester Interface

Enable the API Tester UI to allow interactive API testing directly from the panel:

$api->useAPITester(); // Enable
$api->useAPITester(false); // Disable (default)

Available API Methods

$api
    ->columns([...])           // Define API columns
    ->endpoint('/api/products') // Custom endpoint
    ->perPage(25)              // Items per page
    ->authenticated()          // Require authentication
    ->list(enabled: true)      // Enable/disable list operation
    ->show(enabled: true)      // Enable/disable show operation
    ->create(enabled: true)    // Enable/disable create operation
    ->update(enabled: true)    // Enable/disable update operation
    ->delete(enabled: true)    // Enable/disable delete operation
    ->useAPITester();          // Enable API Tester interface

Multi-Tenancy

Laravilt Panel supports two tenancy modes for building SaaS applications:

Single Database Mode

All tenants share the same database with tenant_id scoping. Uses path-based routing.

use Laravilt\Panel\Panel;
use App\Models\Team;

Panel::make('admin')
    ->path('admin')
    ->tenant(Team::class, 'team', 'slug');

URL Pattern: /admin/{team}/dashboard

Multi-Database Mode

Each tenant has their own database with complete data isolation. Uses subdomain-based routing.

use Laravilt\Panel\Panel;
use Laravilt\Panel\Models\Tenant;

Panel::make('admin')
    ->path('admin')
    ->multiDatabaseTenancy(Tenant::class, 'myapp.com')
    ->tenantRegistration()  // Allow new tenant signup
    ->tenantProfile()       // Enable team settings page
    ->tenantModels([
        \App\Models\Customer::class,
        \App\Models\Product::class,
    ]);

URL Pattern: acme.myapp.com/admin/dashboard

Tenant Model

The built-in Tenant model provides:

  • ULID primary keys
  • Automatic slug and database name generation
  • User membership management (owner, admin, member roles)
  • Settings and data storage
  • Trial period support
  • Domain management
use Laravilt\Panel\Models\Tenant;

$tenant = Tenant::create([
    'name' => 'Acme Corp',
    'owner_id' => $user->id,
]);

// Auto-generated: id, slug, database name

$tenant->addUser($user, 'admin');
$tenant->setSetting('feature.enabled', true);
$tenant->onTrial(); // Check trial status

Configuration

Publish the tenancy configuration:

php artisan vendor:publish --tag=laravilt-tenancy-config

Key configuration options:

// config/laravilt-tenancy.php
return [
    'mode' => env('TENANCY_MODE', 'single'),
    'subdomain' => [
        'domain' => env('APP_DOMAIN', 'localhost'),
        'reserved' => ['www', 'api', 'admin'],
    ],
    'tenant' => [
        'database_prefix' => 'tenant_',
        'auto_migrate' => true,
    ],
];

Migrating from Filament PHP

Laravilt provides an automated migration tool to convert your existing Filament PHP v3/v4 resources to Laravilt.

Quick Migration

php artisan laravilt:filament

This interactive command will:

  1. Scan your app/Filament directory for resources, pages, and widgets
  2. Let you select which components to migrate
  3. Convert namespaces, icons, and method signatures automatically
  4. Generate Laravilt-compatible files in app/Laravilt

Migration Options

# Migrate from custom source directory
php artisan laravilt:filament --source=app/Filament/Admin

# Migrate to custom target directory
php artisan laravilt:filament --target=app/Laravilt/Backend

# Specify panel name
php artisan laravilt:filament --panel=Admin

# Preview changes without making them
php artisan laravilt:filament --dry-run

# Overwrite existing files
php artisan laravilt:filament --force

# Migrate all components without selection prompt
php artisan laravilt:filament --all

What Gets Migrated

Filament Laravilt
Filament\Resources\Resource Laravilt\Panel\Resources\Resource
Filament\Forms\Components\* Laravilt\Forms\Components\*
Filament\Tables\Columns\* Laravilt\Tables\Columns\*
Filament\Infolists\Components\* Laravilt\Infolists\Entries\*
Filament\Actions\* Laravilt\Actions\*
Filament\Pages\* Laravilt\Panel\Pages\*
Filament\Widgets\* Laravilt\Widgets\*
Heroicon enums Lucide icon strings
Get/Set utilities Laravilt\Support\Utilities\Get/Set

Third-Party Package Mappings

The migration tool also handles common third-party Filament packages:

  • RVxLab\FilamentColorPickerLaravilt\Forms\Components\ColorPicker
  • FilamentTiptapEditorLaravilt\Forms\Components\RichEditor
  • Mohamedsabil83\FilamentFormsTinyeditorLaravilt\Forms\Components\RichEditor
  • Spatie MediaLibrary uploads → Laravilt\Forms\Components\FileUpload

Post-Migration Steps

After migration:

  1. Review the generated files for any manual adjustments
  2. Update your panel provider to register the new resources
  3. Run npm run build to compile frontend assets
  4. Test all CRUD operations

Commands

Command Description
laravilt:filament Migrate Filament resources to Laravilt
laravilt:panel {name} Create a new panel
laravilt:resource {panel} Create a resource with interactive prompts
laravilt:page {panel} {name} Create a standalone page
laravilt:cluster {panel} {name} Create a cluster for grouping pages
laravilt:relation {panel} {resource} {name} Create a relation manager

Cluster Command Options

php artisan laravilt:cluster admin Settings \
    --icon=Settings \
    --sort=10 \
    --group="System"

Resource Structure

app/Laravilt/Admin/Resources/Product/
├── ProductResource.php      # Main resource class
├── Form/
│   └── ProductForm.php      # Form configuration
├── Table/
│   └── ProductTable.php     # Table configuration
├── InfoList/
│   └── ProductInfoList.php  # Infolist configuration
├── Api/
│   └── ProductApi.php       # API configuration (optional)
└── Pages/
    ├── ListProduct.php      # List page
    ├── CreateProduct.php    # Create page
    ├── EditProduct.php      # Edit page
    └── ViewProduct.php      # View page

Testing

composer test

Code Style

composer format

Static Analysis

composer analyse

License

The MIT License (MIT). Please see License File for more information.

laravilt/panel 适用场景与选型建议

laravilt/panel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 468 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 12 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「plugin」 「panel」 「laravel」 「dashboard」 「laravilt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 laravilt/panel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 laravilt/panel 我们能提供哪些服务?
定制开发 / 二次开发

基于 laravilt/panel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 468
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 26
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-10