定制 artisanpack-ui/forms 二次开发

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

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

artisanpack-ui/forms

最新稳定版本:1.0.0-beta2

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

ComponentDescription
FormBuilderVisual drag-and-drop form builder interface
FormRendererRenders forms for user submission
FormsListLists and manages forms
SubmissionsListLists and manages submissions
SubmissionDetailDisplays submission details
NotificationEditorConfigure 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:

⚙️ Configuration

Publish the configuration file:

php artisan vendor:publish --tag=forms-config

Environment Variables

The package supports the following environment variables:

VariableDescriptionDefault
FORMS_ADMIN_PREFIXURL prefix for admin routesadmin/forms
FORMS_UPLOADS_DISKStorage disk for file uploadsform-uploads
FORMS_UPLOADS_MAX_SIZEMaximum file size in KB10240 (10MB)
FORMS_RETENTION_DAYSDays to keep submissions (null = forever)null
FORMS_HONEYPOT_ENABLEDEnable honeypot spam protectiontrue
FORMS_RATE_LIMIT_ENABLEDEnable rate limitingtrue
FORMS_RATE_LIMIT_MAXMaximum submissions per minute5
FORMS_WEBHOOKS_ENABLEDEnable webhook integrationstrue
FORMS_RESTRICT_BY_OWNERRestrict forms to their ownersfalse
FORMS_ADMIN_BYPASSAllow admins to bypass ownershiptrue
FORMS_USER_MODELUser model classApp\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 or 12
  • Livewire 3.6+

🤝 Dependencies

This package integrates with the ArtisanPack UI ecosystem:

🎯 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
});

🔌 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:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-01-09