omnitend/dashboard-for-laravel
Composer 安装命令:
composer require omnitend/dashboard-for-laravel
包简介
Laravel dashboard components with Vue 3, Inertia, and Bootstrap Vue Next
README 文档
README
A full-stack package for building Laravel dashboards with Vue 3, Inertia.js, and Bootstrap Vue Next.
Documentation
📚 Browse Components | 📦 NPM Package
- Getting Started Guide
- Installation Guide
- Component API Reference
- Form System Guide
- Theming Guide
- TypeScript Guide
- Examples & Patterns
Features
- Form System: Type-safe form handling with validation
- Data Tables: Paginated data tables with customizable columns
- Navigation: Responsive sidebar navigation
- API Client: Type-safe HTTP client with Laravel integration
- Laravel Helpers: Backend utilities for consistent API responses
- MCP Server: Query documentation via AI agents (setup guide)
Installation
NPM Package
npm install @omnitend/dashboard-for-laravel
Composer Package
composer require omnitend/dashboard-for-laravel
Frontend Usage
Forms
Using defineForm (Recommended)
The defineForm helper provides type-safe form definitions with minimal boilerplate:
<template> <DXForm :form="loginForm" submit-text="Login" submit-loading-text="Logging in..." @submit="handleLogin" /> </template> <script setup lang="ts"> import { defineForm, DXForm } from "@omnitend/dashboard-for-laravel"; const loginForm = defineForm([ { key: "email", type: "email", label: "Email", placeholder: "Enter your email", required: true, default: "", }, { key: "password", type: "password", label: "Password", required: true, default: "", }, { key: "remember", type: "checkbox", label: "Remember me", default: false, }, ] as const); const handleLogin = async () => { await loginForm.form.post<{ redirect?: string }>("/login", { onSuccess: (data) => { window.location.href = data.redirect || "/dashboard"; }, }); }; </script>
Using useForm Directly
For more control, use useForm and DXBasicForm:
<template> <DXBasicForm :form="form" :fields="fields" @submit="handleSubmit" /> </template> <script setup lang="ts"> import { useForm, DXBasicForm, type FieldDefinition } from "@omnitend/dashboard-for-laravel"; const form = useForm({ name: "", email: "", }); const fields: FieldDefinition[] = [ { key: "name", type: "text", label: "Name", required: true }, { key: "email", type: "email", label: "Email", required: true }, ]; const handleSubmit = async () => { await form.post("/api/users"); }; </script>
Supported Field Types
- Text inputs:
text,email,password,number,url,tel,date,datetime-local,time textareaselect(requiresoptionsprop)checkboxradio(requiresoptionsprop)
Form Methods
// Submit methods await form.post("/api/users", options); await form.put("/api/users/1", options); await form.patch("/api/users/1", options); await form.delete("/api/users/1", options); // Form state form.processing; // boolean form.errors; // ValidationErrors form.hasErrors; // computed boolean form.recentlySuccessful; // boolean // Form methods form.reset(); // Reset to initial values form.clearErrors(); // Clear all errors form.clearError("email"); // Clear specific field error
Data Tables
<template> <DXTable title="Users" :items="users" :fields="fields" :pagination="pagination" @page-change="fetchUsers" > <!-- Custom cell rendering --> <template #cell(created_at)="{ item }"> {{ formatDate(item.created_at) }} </template> </DXTable> </template> <script setup lang="ts"> import { ref } from "vue"; import { DXTable, type PaginationData, type TableField } from "@omnitend/dashboard-for-laravel"; interface User { id: number; name: string; email: string; created_at: string; } const users = ref<User[]>([]); const pagination = ref<PaginationData>({ currentPage: 1, perPage: 15, total: 0, }); const fields: TableField[] = [ { key: "id", label: "ID", sortable: true }, { key: "name", label: "Name", sortable: true }, { key: "email", label: "Email" }, { key: "created_at", label: "Created" }, ]; const fetchUsers = async (page: number = 1) => { // Fetch logic here }; </script>
Dashboard Layout
<template> <DXDashboard :navigation="navigation" :current-url="currentUrl" title="My App" page-title="Dashboard" :user="user" > <!-- Page content goes here --> <DCard> <h1>Welcome to the Dashboard</h1> </DCard> </DXDashboard> </template> <script setup lang="ts"> import { DXDashboard, DCard, type Navigation } from "@omnitend/dashboard-for-laravel"; const navigation: Navigation = [ { label: "Main", items: [ { label: "Dashboard", url: "/dashboard" }, { label: "Users", url: "/users" }, ], }, { label: "Settings", items: [ { label: "Profile", url: "/profile" }, { label: "Logout", url: "/logout" }, ], }, ]; const currentUrl = "/dashboard"; const user = { name: "John Doe", email: "john@example.com" }; </script>
Backend Usage
Form Request
<?php namespace App\Http\Requests; use OmniTend\LaravelDashboard\Http\Requests\BaseFormRequest; class StoreUserRequest extends BaseFormRequest { public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'unique:users'], 'password' => ['required', 'min:8'], ]; } protected function getValidationMessage($validator): string { return 'Please check your input and try again.'; } }
API Responses
<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use OmniTend\LaravelDashboard\Traits\HasApiResponses; class UserController extends Controller { use HasApiResponses; public function store(StoreUserRequest $request) { $user = User::create($request->validated()); return $this->success($user, 'User created successfully', 201); } public function destroy(User $user) { $user->delete(); return $this->success(null, 'User deleted successfully'); } }
Paginated Resources
<?php namespace App\Http\Controllers; use App\Models\User; use OmniTend\LaravelDashboard\Http\Resources\PaginatedResource; class UserController extends Controller { public function index() { $users = User::paginate(15); return new PaginatedResource($users); } }
Development
Building the Package
npm run build
Type Checking
npm run typecheck
Watching for Changes
npm run dev
Documentation
The documentation site is built with Astro + Vue 3 + vue-docgen-cli.
Run Documentation Site Locally
# Start Astro dev server npm run docs:dev # Build documentation site npm run docs:build # Preview built documentation npm run docs:preview
Generate Component API Documentation
# Generate markdown docs from component source npm run docs:generate # Generate and build all documentation npm run docs:all
Documentation Features
- Astro - Fast, modern static site generator with Vue 3 support
- vue-docgen-cli - Auto-generates API docs from component source
- Markdown-based - Easy to edit and maintain
- Live Vue components - Can embed interactive examples
- Works with Vite 6 - No version conflicts
Requirements
- PHP ^8.2
- Laravel ^11.0|^12.0
- Vue ^3.4.0
- Bootstrap Vue Next ^0.40.8
License
MIT
omnitend/dashboard-for-laravel 适用场景与选型建议
omnitend/dashboard-for-laravel 是一款 基于 TypeScript 开发的 Composer 扩展包,目前已累计 164 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bootstrap」 「components」 「laravel」 「dashboard」 「vue」 「inertia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omnitend/dashboard-for-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omnitend/dashboard-for-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omnitend/dashboard-for-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
Web Font Loader gives you added control when using linked fonts via @font-face.
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Ariadne Component Library: xml writer and parser Component
Ariadne Component Library: Cache Component
Ariadne Component Library: hierarchical configuration management Component
统计信息
- 总下载量: 164
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-27