hungnm28/livewire-form
Composer 安装命令:
composer require hungnm28/livewire-form
包简介
Reusable Blade UI components for Laravel and Livewire applications.
README 文档
README
Reusable Blade UI components for Laravel and Livewire applications.
Requirements
- PHP 8.3+
- Laravel 10, 11, 12, 13
- Livewire 3 or 4
- Tailwind CSS in the host application
- Alpine.js for modal, aside, fullscreen, and theme interactions
- Tabler Icons Webfont for icon components
Livewire ships Alpine for the common setup. If your app overrides Livewire's frontend assets, make sure Alpine is still available for interactive components.
Installation
composer require hungnm28/livewire-form
Laravel auto-discovers the service provider. The package registers anonymous Blade components under the lf prefix:
<x-lf::form.input name="email" label="Email" /> <x-lf::btn.primary type="submit">Save</x-lf::btn.primary> <x-lf::modal title="Edit user">...</x-lf::modal>
Publishing
php artisan vendor:publish --tag=livewire-form-config php artisan vendor:publish --tag=livewire-form-views php artisan vendor:publish --tag=livewire-form-assets
The assets publish to resources/js/vendor/livewire-form.
Tailwind
Add the package views to your Tailwind content paths so the component classes are generated:
// tailwind.config.js export default { content: [ './resources/**/*.blade.php', './resources/**/*.js', './vendor/hungnm28/livewire-form/resources/views/**/*.blade.php', ], };
The components use primary-* color utilities. Define them in your application theme, or map primary to one of your existing palettes.
JavaScript
If you publish package assets, import them from your app entrypoint:
// resources/js/app.js import './vendor/livewire-form/app';
If you prefer to import directly from vendor, use:
import '../../vendor/hungnm28/livewire-form/resources/js/app';
The JavaScript powers:
- aside open/close via
data-action="toggleAside"anddata-action="closeAside" - light/dark/system theme cycling via
data-action="cycleTheme" - fullscreen toggling via
data-action="toggleFullscreen" - the Alpine
themeSettingstore used by<x-lf::theme.setting />
Components
Form:
<x-lf::form> <x-lf::form.input name="name" label="Name" /> <x-lf::form.select name="role" label="Role" :data="['admin' => 'Admin', 'editor' => 'Editor']" /> <x-lf::form.textarea name="bio" label="Bio" /> <x-lf::form.checkbox name="active" label="Active" value="1" /> <x-lf::form.toggle name="published" label="Published" value="1" /> </x-lf::form>
Livewire binding:
<x-lf::form.input wire:model="form.email" label="Email" />
Buttons:
<x-lf::btn.primary>Primary</x-lf::btn.primary> <x-lf::btn.success>Success</x-lf::btn.success> <x-lf::btn.danger>Delete</x-lf::btn.danger> <x-lf::btn.link.primary href="/users">Users</x-lf::btn.link.primary>
Table:
<x-lf::table title="Users" description="Manage user accounts" density="comfortable"> <x-slot:tools> <x-lf::btn.primary>New user</x-lf::btn.primary> </x-slot:tools> <x-lf::table.thead> <x-lf::table.tr> <x-lf::table.th sortable direction="asc">Name</x-lf::table.th> <x-lf::table.th>Email</x-lf::table.th> <x-lf::table.th align="right">Status</x-lf::table.th> <x-lf::table.th align="right">Actions</x-lf::table.th> </x-lf::table.tr> </x-lf::table.thead> <x-lf::table.tbody> <x-lf::table.tr> <x-lf::table.td strong nowrap>Nguyen Manh Hung</x-lf::table.td> <x-lf::table.td muted>hung@example.com</x-lf::table.td> <x-lf::table.td align="right">Active</x-lf::table.td> <x-lf::table.actions> <x-lf::btn.default class="px-3 py-1.5">Edit</x-lf::btn.default> </x-lf::table.actions> </x-lf::table.tr> </x-lf::table.tbody> </x-lf::table>
Modal:
<x-lf::modal wire:model="editing" title="Edit user" size="lg"> ... </x-lf::modal>
Open or close a modal without Livewire:
window.dispatchEvent(new CustomEvent('open-modal', { detail: 'modal-id' })); window.dispatchEvent(new CustomEvent('close-modal', { detail: 'modal-id' }));
Layout:
<x-lf::layout title="Admin"> <x-slot:aside> <x-lf::aside> <x-lf::aside.item title="Dashboard" icon="home" url="/admin" /> </x-lf::aside> </x-slot:aside> <x-lf::navbar title="Dashboard" /> <main class="p-4"> ... </main> </x-lf::layout>
Configuration
return [ 'theme' => 'orange', 'assets' => [ 'use_cdn_icons' => true, ], ];
Set assets.use_cdn_icons to false when your app bundles @tabler/icons-webfont itself.
Package Livewire components can be registered as alias => class pairs:
'livewire' => [ 'components' => [ 'lf-user-form' => \Hungnm28\LivewireForm\Livewire\UserForm::class, ], ],
Backwards Compatibility
The old typo components still exist:
<x-lf::form.toogle /><x-lf::theme.toogle />
Prefer the corrected aliases:
<x-lf::form.toggle /><x-lf::theme.toggle />
Testing
composer install
composer test
hungnm28/livewire-form 适用场景与选型建议
hungnm28/livewire-form 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ui」 「form」 「laravel」 「blade」 「tailwind」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hungnm28/livewire-form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hungnm28/livewire-form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hungnm28/livewire-form 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
A Laravel Filament Forms slug field.
A jQuery augmented PHP library for creating and validating HTML forms
Laravel contact us form package to send email and save to database
Alfabank REST API integration
Contact Form Module for the Attogram Framework
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-21