artisanpack-ui/forms
Composer 安装命令:
composer require artisanpack-ui/forms
包简介
A comprehensive form builder and management package for Laravel with drag-and-drop builder, submissions, notifications, file uploads, multi-step forms, conditional logic, and webhooks.
README 文档
README
ArtisanPack UI Forms is a comprehensive form builder and management package for Laravel applications. Built on Livewire 3, it provides a drag-and-drop form builder, submission management, email notifications, file uploads, multi-step forms, conditional logic, and webhook integrations.
🚀 Quick Start
Installation
# Install the package composer require artisanpack-ui/forms # Publish configuration and assets php artisan vendor:publish --provider="ArtisanPackUI\Forms\FormsServiceProvider" # Run migrations php artisan migrate
Basic Usage
<!-- Display a form by slug --> <livewire:forms::form-renderer slug="contact" /> <!-- Or by form ID --> <livewire:forms::form-renderer :form-id="1" />
✨ Key Features
- 🎨 Visual Form Builder: Drag-and-drop interface for creating forms without code
- 📝 20+ Field Types: Text, email, textarea, select, checkbox, radio, file upload, date, time, and more
- 📊 Submission Management: View, export, and manage form submissions with ease
- 📧 Email Notifications: Admin notifications and autoresponders with template support
- 📁 Secure File Uploads: Private file storage with MIME validation and size limits
- 📑 Multi-Step Forms: Create wizard-style forms with step navigation
- 🔀 Conditional Logic: Show/hide fields and steps based on user input
- 🔗 Webhook Integration: Send form data to external services with HMAC signatures
- 🛡️ Spam Protection: Built-in honeypot fields and rate limiting
- 🔒 Authorization: Policy-based access control with ownership support
- 📤 Export Options: Export submissions to CSV format
🧩 Components
Livewire Components
| Component | Description |
|---|---|
FormBuilder |
Visual drag-and-drop form builder interface |
FormRenderer |
Renders forms for user submission |
FormsList |
Lists and manages forms |
SubmissionsList |
Lists and manages submissions |
SubmissionDetail |
Displays submission details |
NotificationEditor |
Configure email notifications |
Available Field Types
Basic Fields: Text, Email, URL, Phone, Number, Password, Hidden
Text Fields: Textarea, Rich Text Editor
Selection Fields: Select, Multi-Select, Checkbox, Radio, Toggle
Date/Time Fields: Date, Time, DateTime
File Fields: File Upload, Multiple Files
Layout Fields: Heading, Paragraph, Divider
📖 Documentation
Comprehensive documentation is available in our Documentation Wiki:
- Installation Guide - Detailed setup instructions
- Configuration - All configuration options
- Form Builder - Creating forms
- Form Renderer - Displaying forms
- API Reference - Models, services, and events
⚙️ Configuration
Publish the configuration file:
php artisan vendor:publish --tag=forms-config
Environment Variables
The package supports the following environment variables:
| Variable | Description | Default |
|---|---|---|
FORMS_ADMIN_PREFIX |
URL prefix for admin routes | admin/forms |
FORMS_UPLOADS_DISK |
Storage disk for file uploads | form-uploads |
FORMS_UPLOADS_MAX_SIZE |
Maximum file size in KB | 10240 (10MB) |
FORMS_RETENTION_DAYS |
Days to keep submissions (null = forever) | null |
FORMS_HONEYPOT_ENABLED |
Enable honeypot spam protection | true |
FORMS_RATE_LIMIT_ENABLED |
Enable rate limiting | true |
FORMS_RATE_LIMIT_MAX |
Maximum submissions per minute | 5 |
FORMS_WEBHOOKS_ENABLED |
Enable webhook integrations | true |
FORMS_RESTRICT_BY_OWNER |
Restrict forms to their owners | false |
FORMS_ADMIN_BYPASS |
Allow admins to bypass ownership | true |
FORMS_USER_MODEL |
User model class | App\Models\User |
Configuration Options
Key configuration options in config/artisanpack/forms.php:
return [ // Admin panel settings 'admin' => [ 'prefix' => 'admin/forms', 'middleware' => ['web', 'auth'], ], // File upload settings 'uploads' => [ 'disk' => 'form-uploads', 'max_size' => 10240, // 10MB in KB 'allowed_mimes' => ['image/jpeg', 'image/png', 'application/pdf'], ], // Submission settings 'submissions' => [ 'store_submissions' => true, 'retention_days' => null, // null = keep forever ], // Spam protection 'spam_protection' => [ 'honeypot' => ['enabled' => true], 'rate_limit' => ['enabled' => true, 'max_attempts' => 5], ], ];
🔧 Artisan Commands
# Prune old submissions based on retention settings php artisan forms:prune-submissions # Prune submissions older than specific days php artisan forms:prune-submissions --days=90
📦 Requirements
- PHP 8.2 or higher
- Laravel 11, 12, or 13 (Laravel 13 requires PHP 8.3+)
- Livewire 3.6+
🤝 Dependencies
This package integrates with the ArtisanPack UI ecosystem:
- artisanpack-ui/livewire-ui-components - UI components
- artisanpack-ui/security - Input sanitization and security
- artisanpack-ui/accessibility - Accessibility utilities
- artisanpack-ui/hooks - WordPress-style hooks for extensibility
🎯 Events
The package dispatches events for key actions:
use ArtisanPackUI\Forms\Events\FormCreated; use ArtisanPackUI\Forms\Events\FormSubmitted; use ArtisanPackUI\Forms\Events\SubmissionDeleted; // Listen for form submissions Event::listen(FormSubmitted::class, function ($event) { // $event->submission contains the submission // $event->form contains the form });
🤖 AI features
The Forms package ships four opt-in AI agents that plug into the
artisanpack-ui/ai feature registry.
Install artisanpack-ui/ai (v1.0+) and configure credentials to enable them;
each feature no-ops when its toggle is off, so upgrades are non-breaking.
| Feature key | Agent | Default model | What it does |
|---|---|---|---|
forms.spam_detection |
SpamDetectionAgent |
claude-haiku-4-5 |
Score a single submission for spam. Returns spam_score, verdict, and reasons. |
forms.submission_summary |
SubmissionSummaryAgent |
claude-sonnet-4-6 |
Periodic digest of submission themes, notable entries, and suggested follow-ups. |
forms.response_classification |
ResponseClassificationAgent |
claude-haiku-4-5 |
Categorize a submission against a caller-supplied set of labels; may propose a new one. |
forms.smart_validation |
SmartFieldValidationAgent |
claude-haiku-4-5 |
Opt-in per-field semantic plausibility check that complements format validation. |
Each agent is invoked the same way — construct it with for() and call run():
use ArtisanPackUI\Forms\Ai\Agents\SpamDetectionAgent; $result = SpamDetectionAgent::for([ 'fields' => $submission->data_array, 'meta' => [ 'ip_country' => $submission->ip_country, 'submission_speed_ms' => $submission->submission_speed_ms, ], ])->run(); // [ 'spam_score' => int, 'verdict' => 'ham'|'suspicious'|'spam', 'reasons' => string[] ]
Each feature also ships a Livewire trigger component you can drop into the admin surface. Components no-op when the feature toggle is off:
<livewire:forms::ai-spam-check :submission-id="$submission->id" :fields="$submission->data_array" :meta="[ 'ip_country' => $submission->ip_country ]" /> <livewire:forms::ai-submission-summary form-name="Contact us" window="weekly" :submissions="$submissions" /> <livewire:forms::ai-response-classifier :submission-id="$submission->id" :fields="$submission->data_array" :available-categories="[ 'support-request', 'sales-inquiry', 'feedback', 'bug-report' ]" /> <livewire:forms::ai-smart-field-validator field-name="address" field-label="Address" field-kind="address" :value="$address" :context="[ 'city' => $city, 'state' => $state ]" />
See the AI RFC for the shared registry, toggle, and credential story across ArtisanPack UI packages.
🔌 Extensibility
Add custom field types using filter hooks:
use function addFilter; addFilter('forms.field_types', function (array $types) { $types['my-custom-field'] = [ 'label' => 'My Custom Field', 'view' => 'my-package::fields.custom', 'settings' => ['option1', 'option2'], ]; return $types; });
🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Merge Request
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting merge requests.
📄 License
ArtisanPack UI Forms is open-sourced software licensed under the GPL-3.0-or-later license.
artisanpack-ui/forms 适用场景与选型建议
artisanpack-ui/forms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 84 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 artisanpack-ui/forms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 artisanpack-ui/forms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 39
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-01-09