PHPackages                             masihfathi/yii2-drag-drop-forms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. masihfathi/yii2-drag-drop-forms

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

masihfathi/yii2-drag-drop-forms
===============================

a complete drag and drop form builder

2613JavaScript

Since Nov 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/masihfathi/yii2-drag-drop-forms)[ Packagist](https://packagist.org/packages/masihfathi/yii2-drag-drop-forms)[ RSS](/packages/masihfathi-yii2-drag-drop-forms/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

FormBuilder module for Yii2
===========================

[](#formbuilder-module-for-yii2)

Features
--------

[](#features)

1. Generate forms, surveys, polls, questionnaires (class FormBuilder)

- Drag and drop - Sorting, editing, and deleting items
- CRUD operations by AJAX
- Built-in RBAC component

2. Form render widget (class Form)

- Validation forms (dynamic model)

3. Storage data submitted from form in databases

- List of forms (GridView)
- Create database tables after create form
- Delete database tables after delete form
- Add table column after add field to form
- Rename table column after change the name of field
- Drop table column after delete field in form

User Forms Demo: [![user forms](https://user-images.githubusercontent.com/13271510/33212218-4adb4926-d137-11e7-864d-639cce778934.png)](https://user-images.githubusercontent.com/13271510/33212218-4adb4926-d137-11e7-864d-639cce778934.png)

Added Feature:

- Edit, Delete, Preview of submitted item data
- Search and filter submitted item data
- After submit event for forms data to use form for payments or ...

Submitted Data Demo:

[![submitted data](https://user-images.githubusercontent.com/13271510/33189219-0337fafa-d0b6-11e7-9a8c-788febb158da.png)](https://user-images.githubusercontent.com/13271510/33189219-0337fafa-d0b6-11e7-9a8c-788febb158da.png)

Bug Fixed

- Fix view bugs

To do

- add module to manage payment methods e.g. paypal, local payments and add payments button as optional drag and drop field to the form builder

---

Installation Form Builder
-------------------------

[](#installation-form-builder)

```
composer require masihfathi/yii2-drag-drop-forms "dev-master"

```

Configuration Form Builder
--------------------------

[](#configuration-form-builder)

Make sure that you have properly configured `db` application component in config file and run the following command:

```
$ php yii migrate/up --migrationPath=@vendor/masihfathi/yii2-drag-drop-forms/migrations
```

Add the following code in your configuration file:

```
'modules' => [
    'forms' => [
        'class' => '\masihfathi\form\Module',
     ],
     // Module Kartik-v Grid
    'gridview' => [
        'class' => '\kartik\grid\Module'
     ],
]
```

Usage
-----

[](#usage)

URLs for the translating tool:

```
/forms/module/index                    // List of all forms
/forms/module/user                     // List of user forms
/forms/module/view                     // Preview form
/forms/module/create                   // FormBuilder - create form
/forms/module/update                   // Update form
/forms/module/delete                   // Delete form

```

Full example configuration Form Builder
---------------------------------------

[](#full-example-configuration-form-builder)

```
'modules' => [
      'forms' => [
          'class' => 'masihfathi\form\Module',
          'db' => 'db',
          'formsTable' => '{{%forms}}',
          'formDataTable' => 'form_', // dont use prefix please
          'sendEmail' => true,
          'emailSender' => 'info@email.net',
          'rules' => [
                [
                    'actions' => [ 'update', 'delete', 'clone','deletemultiple','preview','update-item'],
                    'allow' => true,
                    'roles' => ['updateOwnForm'],   // rule only owner can edit form
                ],
                [
                    'actions' => ['user', 'create'],
                    'allow' => true,
                    'roles' => ['user'],            // role only authenticated user can
                ]
            ],
          'controllerMap' => [
            'module' => [
              'class' => '\masihfathi\form\controllers\ModuleController',
              'on afterSubmit'=>function($event){
                    // code
                }
            ]
          ]
      ]
],

```

Form renderer widget
--------------------

[](#form-renderer-widget)

```
use masihfathi\form\Form;
echo Form::widget([
     'body' => '[[{"field": "input", "type": "text", "width": "col-md-5", "name": "email", "placeholder": "email"},{"field": "input", "name": "pass", "type": "text", "placeholder": "pass", "width": "col-md-5"},{"field": "submit", "width": "col-md-2", "backgroundcolor": "btn-info", "label": "Submit"}]]',
     'typeRender' => 'php'
     ]);

```

or

```
  echo Form::widget([
     'formId' => 1, // equivalennt 'form' => FormModel::findOne(1)->body
  ]);

```

Configure RBAC Component
------------------------

[](#configure-rbac-component)

Before you can go on you need to create those tables in the database.

```
php yii migrate --migrationPath=@yii/rbac/migrations

```

Building autorization data

To use generator console, add fallowing code to config console file

```
'controllerMap' => [
  'formsrbac' => [
      'class' => 'masihfathi\form\migrations\RbacController',
  ],
],

```

Create rbac tables in the database

```
php yii migrate --migrationPath=@yii/rbac/migrations

```

Create rules and roles for form module

```
php yii formsrbac/generate

```

Tests
-----

[](#tests)

For tests run

```
composer exec -v -- codecept -c vendor/masihfathi/yii2-drag-drop-forms run

```

or

```
cd vendor/masihfathi/yii2-drag-drop-forms
codecept run

```

dependency
----------

[](#dependency)

```
    "require": {
        "php": ">=7.0.0",
	"yiisoft/yii2": "~2.0.0",
        "kartik-v/yii2-detail-view": "*",
        "kartik-v/yii2-grid": "*"
    }

```

**Font Awesome must be available.**

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/904bedb5b24b908c13b45a4c75ca1570f2e8bb56bf42ff58b3962c55637e156f?d=identicon)[masihfathi](/maintainers/masihfathi)

---

Top Contributors

[![masihfathi](https://avatars.githubusercontent.com/u/13271510?v=4)](https://github.com/masihfathi "masihfathi (31 commits)")

---

Tags

drag-and-dropextensionform-builderphpyii2

### Embed Badge

![Health badge](/badges/masihfathi-yii2-drag-drop-forms/health.svg)

```
[![Health](https://phpackages.com/badges/masihfathi-yii2-drag-drop-forms/health.svg)](https://phpackages.com/packages/masihfathi-yii2-drag-drop-forms)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
