{"id":14966772,"url":"https://github.com/pceuropa/yii2-forms","last_synced_at":"2025-10-25T17:30:42.961Z","repository":{"id":57037054,"uuid":"76054641","full_name":"pceuropa/yii2-forms","owner":"pceuropa","description":"Forms CRUD - formbuilder, generator code","archived":false,"fork":false,"pushed_at":"2019-12-08T22:55:29.000Z","size":672,"stargazers_count":35,"open_issues_count":1,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-31T09:34:08.619Z","etag":null,"topics":["ajax","drag","drop","events","form-builder","forms","jquery","yii2-extension"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pceuropa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-09T17:07:47.000Z","updated_at":"2024-08-06T15:24:00.000Z","dependencies_parsed_at":"2022-08-24T06:41:00.942Z","dependency_job_id":null,"html_url":"https://github.com/pceuropa/yii2-forms","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pceuropa%2Fyii2-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pceuropa%2Fyii2-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pceuropa%2Fyii2-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pceuropa%2Fyii2-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pceuropa","download_url":"https://codeload.github.com/pceuropa/yii2-forms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183712,"owners_count":19430173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","drag","drop","events","form-builder","forms","jquery","yii2-extension"],"created_at":"2024-09-24T13:36:55.440Z","updated_at":"2025-10-25T17:30:37.599Z","avatar_url":"https://github.com/pceuropa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"FormBuilder module for Yii2\n===================\n\n[![Latest Stable Version](https://poser.pugx.org/pceuropa/yii2-forms/v/stable)](https://packagist.org/packages/pceuropa/yii2-forms) [![Total Downloads](https://poser.pugx.org/pceuropa/yii2-forms/downloads)](https://packagist.org/packages/pceuropa/yii2-forms) [![License](https://poser.pugx.org/pceuropa/yii2-forms/license)](https://packagist.org/packages/pceuropa/yii2-forms)\n\n[FormBuilder DEMO](https://pceuropa.net/yii2-extensions/yii2-forms)\n\n## Features\n\n\n1. Generate forms, surveys, polls, questionnaires (class FormBuilder)\n * Drag and drop - Sorting, editing, and deleting items\n * CRUD operations by AJAX\n * Built-in RBAC component\n\n \n2. Form render  widget (class Form)\n * Validation forms (dynamic model)\n\n3. Storage data submited from form in databases\n * List of forms (GridView)\n * Create database tables after create form \n * Delete database tables after delete form\n * Add table column after add field to form \n * Rename table column after change the name of field\n * Drop table column after delete field in form\n\n## Installation Form Builder\n```\ncomposer require pceuropa/yii2-forms\n```\n\n## Configuration Form Builder\nMake sure that you have properly configured `db` application component in config file and run the following command:\n```bash\n$ php yii migrate/up --migrationPath=@vendor/pceuropa/yii2-forms/migrations\n```\n\nAdd the following code in your configuration file:\n```php\n'modules' =\u003e [\n    'forms' =\u003e [\n          'class' =\u003e 'pceuropa\\forms\\Module',\n     ],\n]\n```\n\n##  Usage\nURLs for the translating tool:\n\n```\n/forms/module/index                    // List of all forms                     \n/forms/module/user                     // List user's forms\n/forms/module/view                     // Preview form\n/forms/module/create                   // Create form - FormBuilder \n/forms/module/update                   // Update form \n/forms/module/delete                   // Delete form\n```\n\n## Full example configuration Form Builder\n\n```\n'modules' =\u003e [\n      'forms' =\u003e [\n          'class' =\u003e 'pceuropa\\forms\\Module',\n          'db' =\u003e 'db',\n          'formsTable' =\u003e '{{%forms}}',\n          'formDataTable' =\u003e 'form_',\n          'sendEmail' =\u003e true, \n\t  'testMode' =\u003e false, \n          'easyMode' =\u003e true,\n          'emailSender' =\u003e 'info@email.net',\n          'rules' =\u003e [\n                [\n                    'actions' =\u003e [ 'update', 'delete', 'clone'],\n                    'allow' =\u003e true,\n                    'roles' =\u003e ['updateOwnForm'],   // rule only owner can edit form\n                ],\n                [\n                    'actions' =\u003e ['user'],\n                    'allow' =\u003e true,\n                    'roles' =\u003e ['user'],     // role only authenticated user can see user's forms\n                ],\n                [\n                    'actions' =\u003e ['create'],\n                    'allow' =\u003e true,\n                    'roles' =\u003e ['@'],        // role only logged user can create form\n                ]\n            ]\n      ]\n],\n\n'components' =\u003e [\n\t  'authManager' =\u003e ['class' =\u003e 'yii\\rbac\\DbManager',],\n]\n```\n\n## Form renderer widget\n```\nuse pceuropa\\forms\\Form;\necho Form::widget([\n     'body' =\u003e '[[{\"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\"}]]',\n     'typeRender' =\u003e 'php'\n     ]);\n```\nor\n```\n  echo Form::widget([\n     'formId' =\u003e 1, // equivalennt 'form' =\u003e FormModel::findOne(1)-\u003ebody\n  ]);\n```\n\n## Configure RBAC Component\nTo use generator console, add fallowing code to console config (console.php)\n```\n'controllerMap' =\u003e [\n  'formsrbac' =\u003e [\n      'class' =\u003e 'pceuropa\\forms\\migrations\\RbacController',\n  ],\n],\n```\n\n\nTo use RBAC dont forget add fallowing code to app config (web.php or main.php)\n```\n'components' =\u003e [\n\t  'authManager' =\u003e ['class' =\u003e 'yii\\rbac\\DbManager',],\n]\n```\n\nCreate rbac tables in the database\n```yii migrate --migrationPath=@yii/rbac/migrations```\n\nCreate RBAC rules and roles. Asssign role user to all users. You can add assign role acction in SignupController\n```php yii formsrbac/generate```\n\n\n## Tests\nPhp tests run \n```\nvendor/bin/codecept run -c vendor/pceuropa/yii2-forms\n```\nor\n```\ncd vendor/pceuropa/yii2-forms\n../../bin/codecept run\n```\n\nJavaScript tests run\nOn begining install depencies:\n```\ncd vendor/pceuropa/yii2-forms\nnpm install\n```\n\nrun test\n```\ncd vendor/pceuropa/yii2-forms\nkarma start\n//or if you use karma localy\nnpm run test\n```\n## ex. Menu\n```\n[\n'label' =\u003e 'forms',\n    'items' =\u003e [\n        ['label' =\u003e 'List of all forms', 'url' =\u003e ['/forms/module/index']],\n        ['label' =\u003e 'User\\'s forms', \n            'url' =\u003e ['/forms/module/user'],\n            'visible' =\u003e !Yii::$app-\u003euser-\u003eisGuest\n        ],\n        ['label' =\u003e 'Create form', 'url' =\u003e ['/forms/module/create']],\n    ],\n],\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpceuropa%2Fyii2-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpceuropa%2Fyii2-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpceuropa%2Fyii2-forms/lists"}