ganeshk007/form-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ganeshk007/form-generator

Composer 安装命令:

composer require ganeshk007/form-generator

包简介

A Laravel package for form fields generate

README 文档

README

A dynamic Laravel package for creating reusable form templates, generating forms using configurable field stubs, previewing forms in real time, and exporting the generated HTML code.

Features

  • Manage reusable form templates
  • Define custom template stubs
  • Create dynamic field definitions
  • Support multiple field types
  • Live form preview
  • Generate HTML form code instantly
  • Copy generated code to clipboard
  • Bootstrap-based user interface
  • Easy integration into Laravel applications
  • Package auto-discovery support

Supported Field Types

The package currently supports the following field types:

  • Text
  • Email
  • Password
  • Number
  • Date
  • Textarea
  • Select
  • Radio
  • Checkbox
  • File Upload

Additional field types can easily be added using stub reference templates.

Installation

Install the package via Composer:

composer require ganeshk007/form-generator

Publish package assets and migrations:

php artisan vendor:publish --provider="Ganesh\FormGenerator\FormGeneratorServiceProvider"

Run migrations:

php artisan migrate

Accessing the Package

After installation, access the package using the following routes:

Manage Templates

/form-generator/templates

Generate Forms

/form-generator

Workflow

The package follows a simple workflow:

1. Create a Form Template

Define a reusable form layout using a template stub.

Example:

<form method="POST" action="#">
    @csrf

    [[FIELDS]]

    <button type="submit" class="btn btn-primary">
        Submit
    </button>
</form>

The placeholder [[FIELDS]] will be replaced with generated field HTML.

2. Define Available Fields

Configure field stubs such as:

Example Text Field:

<div class="form-group">
    <label for="{{ $id }}">{{ $name }}</label>

    <input
        type="text"
        id="{{ $id }}"
        name="{{ $name }}"
        class="{{ $class }}"
        {{ $required }}>
</div>

Example Email Field:

<div class="form-group">
    <label for="{{ $id }}">{{ $name }}</label>

    <input
        type="email"
        id="{{ $id }}"
        name="{{ $name }}"
        class="{{ $class }}"
        {{ $required }}>
</div>

3. Generate Forms

Select a template and configure fields by specifying:

  • Field Type
  • Field Label
  • Field ID
  • CSS Class
  • Required Option

Preview the form instantly before exporting.

Screenshots

Manage Form Templates

Manage all created templates and perform edit/delete operations.

Manage Templates

Features:

  • View all templates
  • See field count
  • Edit templates
  • Delete templates
  • Navigate to form generation

Create Form Template

Create reusable form layouts and define available field stubs.

Create Template

Features:

  • Template Name
  • Template Stub Editor
  • Dynamic Field Definitions
  • Add Multiple Fields
  • Save Templates

Generate Form

Generate forms dynamically using existing templates.

Generate Form

Features:

  • Select Template
  • Add Fields
  • Configure IDs and Classes
  • Mark Fields as Required
  • Remove Fields
  • Live Preview
  • Show Generated Code

Generated Code

View and copy the generated HTML.

Show Code

Features:

  • Generated HTML Output
  • Copy to Clipboard
  • Template Stub Integration
  • Field Placeholder Replacement

Example Generated Output

<form method="POST" action="#">

    @csrf

    <div class="form-group">
        <label for="firstname">First Name</label>

        <input
            type="text"
            id="firstname"
            name="First Name"
            class=""
            required>
    </div>

    <div class="form-group">
        <label for="lastname">Last Name</label>

        <input
            type="text"
            id="lastname"
            name="Last Name"
            class=""
            required>
    </div>

    <div class="form-group">
        <label for="email">Email</label>

        <input
            type="email"
            id="email"
            name="Email"
            class="">
    </div>

    <button type="submit" class="btn btn-primary">
        Submit
    </button>

</form>

Extending the Package

You can create custom field types by adding new stubs.

Examples:

  • Color Picker
  • Range Slider
  • Telephone Input
  • URL Input
  • DateTime Picker
  • Multi-select Dropdown
  • Custom Components

Requirements

  • PHP 7.3 or higher
  • Laravel 8.x and above
  • Bootstrap 5

Contributing

Contributions are welcome.

Please fork the repository and submit a pull request for improvements or new features.

License

This package is open-sourced software licensed under the MIT license.

Author

Ganesh Kumar

Laravel Full Stack Developer

GitHub: https://github.com/Ganeshk007 Packagist: https://packagist.org/packages/ganeshk007/form-generator

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固