PHPackages                             palmtree/form - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. palmtree/form

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

palmtree/form
=============

Form builder with Bootstrap v5/v4 classes, validation, Recaptcha support, AJAX submissions and more

v6.4.0(4mo ago)384.8k↓50%81MITPHPPHP &gt;=8.3CI passing

Since Feb 21Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/palmtreephp/form)[ Packagist](https://packagist.org/packages/palmtree/form)[ RSS](/packages/palmtree-form/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (48)Used By (1)

🌴 Palmtree Form
===============

[](#palm_tree-palmtree-form)

[![License](https://camo.githubusercontent.com/ec56ce20d987fdf080a15d9777dfd42d89a4e41b0595e2851ee6a21da5a8555a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70616c6d747265652f666f726d2e737667)](LICENSE)[![Build](https://camo.githubusercontent.com/34ad003b7518fd28a426527b07c9cf7a7c9a3a2b6d72bb416dfe71be7ce0df86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c6d747265657068702f666f726d2f6275696c642e79616d6c3f6272616e63683d6d6173746572)](https://github.com/palmtreephp/form/actions/workflows/build.yaml)[![Packagist Version](https://camo.githubusercontent.com/6813fe712c63a2b74ad2e7360a37d5694cd3e5019cd0d2b24beceb53cd5a1282/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70616c6d747265652f666f726d)](https://packagist.org/packages/palmtree/form)[![npm version](https://camo.githubusercontent.com/6612a2b8da3b291b544d9daab9e9fbf77556ebfc0c13904876f8ea43d99c22fb/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f4070616c6d747265652f666f726d2e737667)](https://www.npmjs.com/package/@palmtree/form)

PHP form builder with [Bootstrap](https://getbootstrap.com/) classes, [validation](docs/constraints.md), [CSRF protection](docs/csrf-protection.md), [data binding](docs/data-binding.md), [Google Recaptcha](https://www.google.com/recaptcha/intro/) and [hCaptcha](https://www.hcaptcha.com/) support, plus other goodies.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3

Installation
------------

[](#installation)

Use composer to add the package to your dependencies:

```
composer require palmtree/form
```

Optional: Install the NPM package for AJAX form submission, CAPTCHA support and form collections:

```
npm install @palmtree/form
```

Usage Example
-------------

[](#usage-example)

#### Build

[](#build)

```
use Palmtree\Form\FormBuilder;
use Palmtree\Form\Captcha\GoogleRecaptcha;
use Palmtree\Form\Captcha\HCaptcha;

$builder = (new FormBuilder('my_form'))
    ->add('name', 'text', ['error_message' => 'Please enter your name'])
    ->add('email_address', 'email', [
        'help' => 'We will never share your email with anyone',
    ])
    ->add('message', 'textarea', [
        'required' => false,
        'label' => 'Enter your message',
    ])
    ->add('recaptcha', 'captcha', [
        'captcha' => new GoogleRecaptcha('', ''),
        //'captcha' => new HCaptcha('', ''),
    ]);

$builder->add('send_message', 'submit');

$form = $builder->getForm();
// Set $form to some variable accessible in a view
```

#### Render

[](#render)

```

    render(); ?>

```

#### Process

[](#process)

```
$form->handleRequest();

if ($form->isSubmitted() && $form->isValid()) {
    // Send an email/save to database etc
    $name = $form->get('name')->getData();
}
```

See the [examples](examples) directory for examples using AJAX, file uploads, collections and more.

Documentation
-------------

[](#documentation)

[View the documentation](docs/index.md) for more advanced usage.

Examples
--------

[](#examples)

The simplest way to run the examples is run the serve.sh script. This script starts a small PHP Docker container and serves the examples using PHP's built-in web server.

```
./examples/serve.sh
```

License
-------

[](#license)

Released under the [MIT license](LICENSE)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance75

Regular maintenance activity

Popularity35

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.7% 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 ~61 days

Recently: every ~26 days

Total

42

Last Release

138d ago

Major Versions

v1.0.6 → v2.0.02019-03-02

v2.0.2 → v3.0.02020-04-13

v3.0.4 → v4.0.02021-03-28

v4.5.1 → v5.0.02024-05-02

v5.0.1 → v6.0.02024-08-22

PHP version history (4 changes)v1.0.0PHP &gt;=5.6

v4.0.0PHP &gt;=7.1

v5.0.0PHP &gt;=8.1

v6.3.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/93cd57de0c03bc08173bbe424ce641b70b1bb9421f8d8fd474a33409a0f1644d?d=identicon)[palmtree](/maintainers/palmtree)

---

Top Contributors

[![andyexeter](https://avatars.githubusercontent.com/u/6660584?v=4)](https://github.com/andyexeter "andyexeter (361 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

ajaxbootstrapcaptchacomposer-packagecsrf-protectionform-builderformsphprecaptcharecaptchacaptchaajaxbootstrapformform-builder

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/palmtree-form/health.svg)

```
[![Health](https://phpackages.com/badges/palmtree-form/health.svg)](https://phpackages.com/packages/palmtree-form)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[abanoubnassem/filament-grecaptcha-field

Provides a Google reCaptcha V2 field for the Filament Forms

27116.1k2](/packages/abanoubnassem-filament-grecaptcha-field)[aryehraber/statamic-captcha

Protect your Statamic forms using a Captcha service

16194.4k](/packages/aryehraber-statamic-captcha)[lrgt/laravel-form-ajax-validation

Make ajax validation with Laravel Requests for forms with bootstrap

435.6k](/packages/lrgt-laravel-form-ajax-validation)

PHPackages © 2026

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