PHPackages                             pitch/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. [Templating &amp; Views](/categories/templating)
4. /
5. pitch/form

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

pitch/form
==========

Form action

v1.2.0(3y ago)1204MITPHPPHP &gt;=7.4

Since May 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ph-fritsche/symfony-form)[ Packagist](https://packagist.org/packages/pitch/form)[ RSS](/packages/pitch-form/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (8)Versions (5)Used By (0)

Form controllers
================

[](#form-controllers)

Streamlined controllers handling form input.

Usage
-----

[](#usage)

### Annotate controller

[](#annotate-controller)

Keep creating and handling the form input out of your controller by annotating it with the desired [FormType](https://symfony.com/doc/current/forms.html#creating-form-classes).

```
namespace App\Controller;

use App\Form\MyFormType;
use Pitch\Form\Form;

class MyController
{
    #[Form(MyFormType::class)]
    public function __invoke($data)
    {
        // Just handle the data of a valid form.
        // If the form is not submitted yet or the input is invalid,
        // the controller will not be called and the
        // Symfony\Component\Form\FormInstance will be returned.
    }
}
```

This also supports [Doctrine Annotations](https://github.com/doctrine/annotations/) if installed.

### Handle `FormInstance` controller return

[](#handle-forminstance-controller-return)

Symfony requires controllers to return a `Symfony\Component\HttpFoundation\Response`. But you can convert other return values (like the `FormInstance`) on the `kernel.view` event. Add your own [EventSubscriber](https://symfony.com/doc/current/event_dispatcher.html#creating-an-event-subscriber)or [add a ResponseHandler with pitch/symfony-adr](https://github.com/ph-fritsche/symfony-adr#turn-controller-into-action).

### Use the form inside the controller

[](#use-the-form-inside-the-controller)

Just like the data for valid forms the `FormInstance` is made available to the controller per \[Request attributes\])[https://symfony.com/doc/current/components/http\_foundation.html#accessing-request-data](https://symfony.com/doc/current/components/http_foundation.html#accessing-request-data)). [Symfony's RequestAttributeValueResolver](https://symfony.com/doc/current/controller/argument_value_resolver.html#built-in-value-resolvers) injects them into the controller if there is a parameter with the same name as the attribute. The attribute names default to just `data` and `form`, but in case of conflicts you could provide others per annotation.

```
namespace App\Controller;

use App\Form\MyFormType;
use Pitch\Form\Form;
use Symfony\Component\Form\FormInterface;

class MyController
{
    #[Form(
        MyFormType::class,
        dataAttr: 'myData',
        formAttr: 'myForm',
    )]
    public function __invoke(
        Request $request,
        FormInterface $myForm,
        $myData,
    ) {
    }
}
```

You can prevent the automatic return of invalid or unsubmitted forms per annotation `#[Form(MyFormType::class, returnForm: false)]` or per [config parameter](https://symfony.com/doc/current/configuration.html#configuration-parameters) `pitch_form.returnForm: false`.

### Use data entities

[](#use-data-entities)

```
namespace App\Controller;

use App\Form\MyFormType;
use App\Form\MyFormEntity;
use Pitch\Form\Form;

class MyController
{
    #[Form(
        MyFormType::class,
        entity: MyFormEntity::class,
    )]
    public function __invoke(MyFormEntity $data)
    {
    }
}
```

If the entity can not be created by just calling the constructor, you can register a factory implementing `Pitch\Form\FormEntityFactoryInterface` as a service.

```
namespace App\Controller;

use App\Form\MyFormType;
use App\Form\MyFormEntity;
use Pitch\Form\Form;

class MyController
{
    #[Form(
        MyFormType::class,
        entityFactory: 'myFactoryId',
    )]
    public function __invoke(MyFormEntity $data)
    {
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

3

Last Release

1426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14faf0e942f2e3361ad07e017bf356d02bb7b76ab47d66a0d52faf4c03e6faec?d=identicon)[ph.fritsche](/maintainers/ph.fritsche)

---

Top Contributors

[![ph-fritsche](https://avatars.githubusercontent.com/u/39068198?v=4)](https://github.com/ph-fritsche "ph-fritsche (13 commits)")

---

Tags

symfonyformcontrollerannotation

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[craue/formflow-bundle

Multi-step forms for your Symfony project.

7484.0M13](/packages/craue-formflow-bundle)[a2lix/auto-form-bundle

Automate form building

873.8M11](/packages/a2lix-auto-form-bundle)[qossmic/rich-model-forms-bundle

Provides additional data mapper options that ease the use of the Symfony Form component with rich models.

218278.7k](/packages/qossmic-rich-model-forms-bundle)[nucleos/antispam-bundle

This bundle provides some basic features to reduce spam in symfony forms.

52105.1k](/packages/nucleos-antispam-bundle)[boekkooi/jquery-validation-bundle

Jquery form validation bundle for symfony 2

2773.9k1](/packages/boekkooi-jquery-validation-bundle)[thrace/form-bundle

This bundle provides extra form types empowered by jQuery

2515.7k](/packages/thrace-form-bundle)

PHPackages © 2026

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