PHPackages                             progphil1337/php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. progphil1337/php-forms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

progphil1337/php-forms
======================

Create forms using PHP

v1.0.3(3y ago)12MITPHPPHP ^8.1

Since Sep 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/progphil1337/php-forms)[ Packagist](https://packagist.org/packages/progphil1337/php-forms)[ RSS](/packages/progphil1337-php-forms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

PHP-HTML
========

[](#php-html)

Create forms with PHP

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

[](#installation)

Install with composer:

```
$ composer require progphil1337/php-forms
```

Compatibility
-------------

[](#compatibility)

`ProgPhil1337\Forms` requires PHP 8.1 (or better).

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

ExampleForm.php

```
use ProgPhil1337\Forms\Element\Input;
use ProgPhil1337\Forms\Element\Radio;
use ProgPhil1337\Forms\Element\Select;
use ProgPhil1337\Forms\Enum\InputType;
use ProgPhil1337\Forms\Form;
use ProgPhil1337\Forms\Validation\Validator\MaxLength;
use ProgPhil1337\Forms\Validation\Validator\MinLength;
use ProgPhil1337\Forms\Validation\Validator\IsRequired;
use ProgPhil1337\Forms\Enum\RequestMethod;

class ExampleForm extends Form
{

    public function __construct()
    {
        parent::__construct('example-form', RequestMethod::POST);
    }

    protected function build(): void
    {
        $username = new Input('username', InputType::TEXT, 'Username');
        $username->addValidator(new MaxLength(1));
        $username->addValidator(new MinLength(1));
        $username->addValidator(new IsRequired(true));
        $this->add($username);

        $mail = new Input('mail', InputType::EMAIL, 'E-Mail');
        $this->add($mail);

        $radio = new Radio('language', [
            'php' => 'PHP',
            'csharp' => 'C-Sharp'
        ], 'Favorite Language');
        $radio->setValue('php');
        $this->add($radio);

        $select = new Select('car', [
            'volvo' => 'Volvo',
            'vw' => 'VW',
            'bmw' => 'BMW',
            'audi' => 'Audi'
        ], 'Favorite car');

        $select->setValue('audi'); // obviously
        $this->add($select);

        $this->submitButton('Speichern');
    }
}
```

SomeHandler.php

```
$form = new ExampleForm();

$form->setDefaultValues([
    'mail' => 'example@mail.com'
]);

$errorMessages = [];

if ($request->method->value === $form->method->value) {
    $result = $form->validate($request->body);
    $valid = $result->isValid();

    if (!$valid) {
        foreach ($result->getErrorMessages() as $inputName => $validators) {
            $errorMessages[$inputName] = [];
            foreach ($validators as $info) {
                $errorMessages[$inputName][] = $info['message'];
            }
        }
    }
}

someRenderFunction('someTemplate.twig', [
    'form' => $form,
    'errorMessages' => $errorMessages
])
```

someTemplate.twig

```
{{ form.openTag()|raw }}
{{ errorMessages["username"]|join('') }}
{{ form.get("username").label|raw }}
{{ form.get("username").element|raw }}

{{ errorMessages["mail"]|join('') }}
{{ form.get("mail").label|raw }}
{{ form.get("mail")|raw }}
...

{{ form.get("submit").element|raw }}
{{ form.closeTag()|raw }}

{# you can also just do form|raw to auto generate the html #}

{{ form|raw }}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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 ~0 days

Total

4

Last Release

1341d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe0febabf0b72bbeb1eaa56bb63cd3b97c9f8eb8ffbb8d61ac8b74f934adc756?d=identicon)[progphil1337](/maintainers/progphil1337)

---

Top Contributors

[![progphil1337](https://avatars.githubusercontent.com/u/8302313?v=4)](https://github.com/progphil1337 "progphil1337 (1 commits)")

### Embed Badge

![Health badge](/badges/progphil1337-php-forms/health.svg)

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

PHPackages © 2026

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