{"id":28905656,"url":"https://github.com/luyadev/luya-module-forms","last_synced_at":"2025-07-04T15:37:40.095Z","repository":{"id":46575363,"uuid":"294383254","full_name":"luyadev/luya-module-forms","owner":"luyadev","description":"Generate Forms with CMS Blocks","archived":false,"fork":false,"pushed_at":"2024-01-14T17:56:31.000Z","size":238,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-01T15:31:08.108Z","etag":null,"topics":["form","formbuilder","forms","hacktoberfest","luya"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/luyadev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-09-10T10:56:08.000Z","updated_at":"2023-11-27T15:34:06.000Z","dependencies_parsed_at":"2022-08-26T05:10:38.817Z","dependency_job_id":"6a0cc5ea-23e4-45a7-b151-3cf53033fdd9","html_url":"https://github.com/luyadev/luya-module-forms","commit_stats":{"total_commits":170,"total_committers":4,"mean_commits":42.5,"dds":0.07058823529411762,"last_synced_commit":"daebd54ad1a8ae3002390b7cd51e09b22c4b3519"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":"luyadev/luya-package-skeleton","purl":"pkg:github/luyadev/luya-module-forms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luyadev%2Fluya-module-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luyadev%2Fluya-module-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luyadev%2Fluya-module-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luyadev%2Fluya-module-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luyadev","download_url":"https://codeload.github.com/luyadev/luya-module-forms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luyadev%2Fluya-module-forms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261129161,"owners_count":23113772,"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":["form","formbuilder","forms","hacktoberfest","luya"],"created_at":"2025-06-21T13:31:13.801Z","updated_at":"2025-07-04T15:37:40.090Z","avatar_url":"https://github.com/luyadev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png\" alt=\"LUYA Logo\"/\u003e\n\u003c/p\u003e\n\n# LUYA CMS Forms Builder\n\n[![LUYA](https://img.shields.io/badge/Powered%20by-LUYA-brightgreen.svg)](https://luya.io)\n![Tests](https://github.com/luyadev/luya-module-forms/workflows/Tests/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/41f50ebcd7330406bcc4/maintainability)](https://codeclimate.com/github/luyadev/luya-module-forms/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/41f50ebcd7330406bcc4/test_coverage)](https://codeclimate.com/github/luyadev/luya-module-forms/test_coverage)\n\nA Drag \u0026 Drop Forms Builder based on LUYA CMS Blocks.\n\nAvailable forms module block extensions:\n\n+ [ReCaptcha 3 Forms Block](https://github.com/luyadev/luya-forms-captcha)\n\n## Installation\n\nInstall the extension through composer:\n\n```sh\ncomposer require luyadev/luya-module-forms\n```\n\nAdd the module to the config\n\n```php\n'modules' =\u003e [\n    //...\n    'forms' =\u003e [\n        'class' =\u003e 'luya\\forms\\Module',\n    ]\n]\n```\n\nRun the migrate command which does the database table setup:\n\n```sh\n./luya migrate\n```\n\nRun the import command in order to setup all the need permissions:\n\n```sh\n./luya import\n```\n\n## Adjust Mailer Component\n\nIn order to customize the mailer component which should be taken for sending the mails, define the Forms component with the given callback.\n\n```php\n'components' =\u003e [\n    //...\n    'forms' =\u003e [\n        'class' =\u003e 'luya\\forms\\Forms',\n        'emailMessage' =\u003e function (SubmissionEmail $email, Forms $form) {\n        \n            // your custom mailer integration is here, ensure to return a boolean\n            // value whether sending was successfull or not!    \n            return \\Yii::$app-\u003emailer-\u003ecompose()\n                -\u003esetFrom(...)\n                -\u003esetTo($email-\u003egetRecipients())\n                -\u003esetSubject($email-\u003egetSubject())\n                -\u003esetTextBody($email-\u003egetBodyText())\n                -\u003esetHtmlBody($email-\u003egetBodyHtml())\n                -\u003esend();\n        }\n    ]\n]\n```\n\nMaybe the client would like to recieve a custom email, therefore you can extract the attribute value with `$email-\u003esubmission-\u003egetValueByAttribute('email_attribute_in_form')`.\n\n```php\n'emailMessage' =\u003e function (SubmissionEmail $email, Forms $form) {\n    return Yii::$app-\u003emailer-\u003ecompose()\n        -\u003esetTo($email-\u003esubmission-\u003egetValueByAttribute('email')) // receives the value from the user entered data.        \n        ....\n}\n```\n\n## Create Custom Form Field Blocks\n\nThe default blocks may not suit your needs, therefore its possible to create your own from input block:\n\n```php\nclass MyDropDownBlock extends PhpBlock\n{\n    use FieldBlockTrait;\n    \n    public function name()\n    {\n        return 'Dropdown';\n    }\n\n    public function admin()\n    {\n        return '\u003cp\u003eMy Dropdown {{vars.label}}\u003c/p\u003e';\n    }\n\n    public function frontend()\n    {\n        Yii::$app-\u003eforms-\u003eautoConfigureAttribute(\n            $this-\u003egetVarValue($this-\u003evarAttribute),\n            $this-\u003egetVarValue($this-\u003evarRule, $this-\u003edefaultRule), \n            $this-\u003egetVarValue($this-\u003evarIsRequired),\n            $this-\u003egetVarValue($this-\u003evarLabel),\n            $this-\u003egetVarValue($this-\u003evarHint)\n        );\n\n        // Use all possible options with ActiveField or use the HtmlHelper\n        return Yii::$app-\u003eforms-\u003eform-\u003efield(Yii::$app-\u003eforms-\u003emodel, $this-\u003egetVarValue($this-\u003evarAttribute))\n            -\u003edropDownList([1 =\u003e 'Foo', 2 =\u003e 'Bar']);\n    }\n}\n```\n\n## Development\n\nRefresh message files:\n\n```php\n./vendor/bin/luya message msgconfig.php \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluyadev%2Fluya-module-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluyadev%2Fluya-module-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluyadev%2Fluya-module-forms/lists"}