PHPackages                             pceuropa/yii2-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. pceuropa/yii2-forms

ActiveYii2-extension

pceuropa/yii2-forms
===================

Form builder or code generator for Yii2. List GridView of forms. Saving form data in a databases.

3.0.4(6y ago)361.8k16MITJavaScriptPHP &gt;=7.0.0

Since Jan 21Pushed 6y ago4 watchersCompare

[ Source](https://github.com/pceuropa/yii2-forms)[ Packagist](https://packagist.org/packages/pceuropa/yii2-forms)[ Docs](https://pceuropa.net/yii2-extensions/yii2-forms)[ RSS](/packages/pceuropa-yii2-forms/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/4dc5461bea9741c8c248751b01773279e2d5280646498db0af92d9c62e15fc38/68747470733a2f2f706f7365722e707567782e6f72672f70636575726f70612f796969322d666f726d732f762f737461626c65)](https://packagist.org/packages/pceuropa/yii2-forms) [![Total Downloads](https://camo.githubusercontent.com/cbb378415151ccfb6801d62b1e0c46cece0356fbb88c59f9078bb14353bf13da/68747470733a2f2f706f7365722e707567782e6f72672f70636575726f70612f796969322d666f726d732f646f776e6c6f616473)](https://packagist.org/packages/pceuropa/yii2-forms) [![License](https://camo.githubusercontent.com/43171f3e7a96adee3b7661c02d46aaab375691ffe8d2de0b270a8c4abb237794/68747470733a2f2f706f7365722e707567782e6f72672f70636575726f70612f796969322d666f726d732f6c6963656e7365)](https://packagist.org/packages/pceuropa/yii2-forms)

[FormBuilder DEMO](https://pceuropa.net/yii2-extensions/yii2-forms)

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 submited 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

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

[](#installation-form-builder)

```
composer require pceuropa/yii2-forms

```

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/pceuropa/yii2-forms/migrations
```

Add the following code in your configuration file:

```
'modules' => [
    'forms' => [
          'class' => 'pceuropa\forms\Module',
     ],
]
```

Usage
-----

[](#usage)

URLs for the translating tool:

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

```

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

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

```
'modules' => [
      'forms' => [
          'class' => 'pceuropa\forms\Module',
          'db' => 'db',
          'formsTable' => '{{%forms}}',
          'formDataTable' => 'form_',
          'sendEmail' => true,
	  'testMode' => false,
          'easyMode' => true,
          'emailSender' => 'info@email.net',
          'rules' => [
                [
                    'actions' => [ 'update', 'delete', 'clone'],
                    'allow' => true,
                    'roles' => ['updateOwnForm'],   // rule only owner can edit form
                ],
                [
                    'actions' => ['user'],
                    'allow' => true,
                    'roles' => ['user'],     // role only authenticated user can see user's forms
                ],
                [
                    'actions' => ['create'],
                    'allow' => true,
                    'roles' => ['@'],        // role only logged user can create form
                ]
            ]
      ]
],

'components' => [
	  'authManager' => ['class' => 'yii\rbac\DbManager',],
]

```

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

[](#form-renderer-widget)

```
use pceuropa\forms\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)

To use generator console, add fallowing code to console config (console.php)

```
'controllerMap' => [
  'formsrbac' => [
      'class' => 'pceuropa\forms\migrations\RbacController',
  ],
],

```

To use RBAC dont forget add fallowing code to app config (web.php or main.php)

```
'components' => [
	  'authManager' => ['class' => 'yii\rbac\DbManager',],
]

```

Create rbac tables in the database `yii migrate --migrationPath=@yii/rbac/migrations`

Create RBAC rules and roles. Asssign role user to all users. You can add assign role acction in SignupController `php yii formsrbac/generate`

Tests
-----

[](#tests)

Php tests run

```
vendor/bin/codecept run -c vendor/pceuropa/yii2-forms

```

or

```
cd vendor/pceuropa/yii2-forms
../../bin/codecept run

```

JavaScript tests run On begining install depencies:

```
cd vendor/pceuropa/yii2-forms
npm install

```

run test

```
cd vendor/pceuropa/yii2-forms
karma start
//or if you use karma localy
npm run test

```

ex. Menu
--------

[](#ex-menu)

```
[
'label' => 'forms',
    'items' => [
        ['label' => 'List of all forms', 'url' => ['/forms/module/index']],
        ['label' => 'User\'s forms',
            'url' => ['/forms/module/user'],
            'visible' => !Yii::$app->user->isGuest
        ],
        ['label' => 'Create form', 'url' => ['/forms/module/create']],
    ],
],

```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~121 days

Total

14

Last Release

2346d ago

Major Versions

1.5.0 → 2.0.02018-05-25

2.0.4 → 3.0.32019-12-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d8b352463e73aaf2423e8d02e6755fac6d3637f3c97799b4009e40cf8c0697f?d=identicon)[pceuropa](/maintainers/pceuropa)

---

Top Contributors

[![pceuropa](https://avatars.githubusercontent.com/u/9319670?v=4)](https://github.com/pceuropa "pceuropa (168 commits)")

---

Tags

ajaxdragdropeventsform-builderformsjqueryyii2-extensionyii2extensionbootstrap formform-builderdynamic-modelform creatordrag end dropwithout model

### Embed Badge

![Health badge](/badges/pceuropa-yii2-forms/health.svg)

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

###  Alternatives

[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[pceuropa/yii2-menu

Menu bootstrap builder. Sort by drag and drop

2711.8k](/packages/pceuropa-yii2-menu)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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