{"id":19951291,"url":"https://github.com/palmtreephp/form","last_synced_at":"2025-04-07T10:21:47.940Z","repository":{"id":41579855,"uuid":"71888667","full_name":"palmtreephp/form","owner":"palmtreephp","description":":palm_tree: Form builder with Bootstrap classes, validation, data binding, CAPTCHAs, AJAX submissions and more","archived":false,"fork":false,"pushed_at":"2025-02-06T20:51:02.000Z","size":525,"stargazers_count":36,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T09:08:58.162Z","etag":null,"topics":["ajax","bootstrap","captcha","composer-package","form-builder","forms","php","recaptcha"],"latest_commit_sha":null,"homepage":"","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/palmtreephp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-25T11:06:20.000Z","updated_at":"2025-03-18T14:17:19.000Z","dependencies_parsed_at":"2024-01-29T22:28:28.017Z","dependency_job_id":"92897af6-b317-495f-9e7b-d3ea01fdc63e","html_url":"https://github.com/palmtreephp/form","commit_stats":{"total_commits":249,"total_committers":2,"mean_commits":124.5,"dds":0.004016064257028162,"last_synced_commit":"c930cc2f55bbfb83af75614a0214e4956b5fa72c"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palmtreephp","download_url":"https://codeload.github.com/palmtreephp/form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247631833,"owners_count":20970069,"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","bootstrap","captcha","composer-package","form-builder","forms","php","recaptcha"],"created_at":"2024-11-13T01:07:27.243Z","updated_at":"2025-04-07T10:21:47.908Z","avatar_url":"https://github.com/palmtreephp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :palm_tree: Palmtree Form\n\n[![License](http://img.shields.io/packagist/l/palmtree/form.svg)](LICENSE)\n[![Build](https://img.shields.io/github/actions/workflow/status/palmtreephp/form/build.yaml?branch=master)](https://github.com/palmtreephp/form/actions/workflows/build.yaml)\n[![Packagist Version](https://img.shields.io/packagist/v/palmtree/form)](https://packagist.org/packages/palmtree/form)\n[![npm version](https://img.shields.io/npm/v/@palmtree/form.svg)](https://www.npmjs.com/package/@palmtree/form)\n\nPHP form builder with [Bootstrap](https://getbootstrap.com/) classes, [validation](docs/constraints.md), [data binding](docs/data-binding.md),\n[Google Recaptcha](https://www.google.com/recaptcha/intro/) and [hCaptcha](https://www.hcaptcha.com/) support, plus other goodies.\n\n## Requirements\n\n* PHP \u003e= 8.1\n\n## Installation\n\nUse composer to add the package to your dependencies:\n\n```sh\ncomposer require palmtree/form\n```\n\nOptional: Install the NPM package for AJAX form submission, CAPTCHA support and form collections:\n\n```sh\nnpm install @palmtree/form\n```\n\n## Usage Example\n\n#### Build\n\n```php\nuse Palmtree\\Form\\FormBuilder;\nuse Palmtree\\Form\\Captcha\\GoogleRecaptcha;\nuse Palmtree\\Form\\Captcha\\HCaptcha;\n\n$builder = (new FormBuilder('my_form'))\n    -\u003eadd('name', 'text', ['error_message' =\u003e 'Please enter your name'])\n    -\u003eadd('email_address', 'email', [\n        'help' =\u003e 'We will never share your email with anyone',\n    ])\n    -\u003eadd('message', 'textarea', [\n        'required' =\u003e false,\n        'label' =\u003e 'Enter your message',\n    ])\n    -\u003eadd('recaptcha', 'captcha', [\n        'captcha' =\u003e new GoogleRecaptcha('\u003csite_key\u003e', '\u003csecret\u003e'),\n        //'captcha' =\u003e new HCaptcha('\u003csite_key\u003e', '\u003csecret\u003e'),\n    ]);\n\n$builder-\u003eadd('send_message', 'submit');\n\n$form = $builder-\u003egetForm();\n// Set $form to some variable accessible in a view\n\n```\n\n#### Render\n\n```html\n\n\u003cdiv class=\"container\"\u003e\n    \u003c?= $form-\u003erender(); ?\u003e\n\u003c/div\u003e\n\n\u003c!-- Optional JS for AJAX submissions, CAPTCHA support and form collections --\u003e\n\u003cscript src=\"https://unpkg.com/@palmtree/form@6.1.0/dist/palmtree-form.pkgd.min.js\"\u003e\u003c/script\u003e\n```\n\n#### Process\n\n```php\n$form-\u003ehandleRequest();\n\nif ($form-\u003eisSubmitted() \u0026\u0026 $form-\u003eisValid()) {\n    // Send an email/save to database etc\n    $name = $form-\u003eget('name')-\u003egetData();\n}\n```\n\nSee the [examples](examples) directory for examples using AJAX, file uploads, collections and more.\n\n## Documentation\n\n[View the documentation](docs/index.md) for more advanced usage.\n\n## Examples\n\nThe simplest way to run the examples is run the serve.sh script. This script starts a small PHP Docker container\nand serves the examples using PHP's built-in web server.\n\n```sh\n./examples/serve.sh\n```\n\n## License\n\nReleased under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalmtreephp%2Fform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fform/lists"}