PHPackages                             alsatian/form-bundle - 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. alsatian/form-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

alsatian/form-bundle
====================

Symfony form types to extend built-in types. Ideal for Select2 AJAX implementations.

1.1.3(2y ago)1424.9k↓70.4%6[3 issues](https://github.com/Alsatian67/FormBundle/issues)MITPHPCI failing

Since Jul 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Alsatian67/FormBundle)[ Packagist](https://packagist.org/packages/alsatian/form-bundle)[ RSS](/packages/alsatian-form-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (13)Versions (10)Used By (0)

FormBundle
==========

[](#formbundle)

This bundle provide FormTypes extending ChoiceType, EntityType and DocumentType to let them accept additional choices added on the client side.

Ideal for [Select2](https://select2.github.io/) integration.

Use version 1.1 for Symfony &gt;= 4.4 Use version 1.0 for Symfony 2.8 to 4.3

Features
========

[](#features)

The bundle provide 6 FormTypes designed to automate some common tasks :
-----------------------------------------------------------------------

[](#the-bundle-provide-6-formtypes-designed-to-automate-some-common-tasks-)

- ***ExtensibleChoiceType*** : Extension for the built-in ChoiceType

    Choice type which starts with an empty HTML select and accept each submitted choice which has be added on the client side.

    - **Configuration** : Insert %alsatian\_form.parameters.extensible\_choice.attr\_class% as class for the HTML select.
    - **Options** : 'route' and 'route\_params' to render a data-ajax--url tag in the HTML select.
- ***ExtensibleEntityType*** : Extension for the built-in EntityType

    Entity type type which starts with an empty HTML select and accept each existing entity which has be added on the client side.

    - **Configuration** : Insert %alsatian\_form.parameters.extensible\_entity.attr\_class% as class for the HTML select.
    - **Options** : 'route' and 'route\_params' to render a data-ajax--url tag in the HTML select.
- ***ExtensibleDocumentType*** : Extension for the DoctrineMongoDBBundle DocumentType

    Document type which starts with an empty HTML select and accept each existing document which has be added on the client side.

    - **Configuration** : Insert %alsatian\_form.parameters.extensible\_document.attr\_class% as class for the HTML select.
    - **Options** : 'route' and 'route\_params' to render a data-ajax--url tag in the HTML select.
- ***AutocompleteType*** : Extension for the built-in TextType

    Text type allowing to add some html attributes to expose ajax route for autocompletion.

    - **Configuration** : Insert %alsatian\_form.parameters.autocomplete.attr\_class% as class for the HTML input.
    - **Options** : 'route' and 'route\_params' to render a data-ajax--url tag in the HTML input.
- ***DatepickerType*** : Extension for the built-in DateType

    Date type where the date pattern is rendered as 'pattern' attribute in the HTML input (Using \\IntlDateFormatter::SHORT).

    - **Configuration** : Insert %alsatian\_form.parameters.date\_picker.attr\_class% as class for the HTML input.
- ***DateTimepickerType*** : Extension for the built-in DateTimeType

    DateTime type where the date pattern is rendered as 'pattern' attribute in the HTML input (Using \\IntlDateFormatter::SHORT).

    - **Configuration** : Insert %alsatian\_form.parameters.datetime\_picker.attr\_class% as class for the HTML input.

Installation
============

[](#installation)

***Download the bundle with composer***

```
    composer require alsatian/form-bundle
```

***Enable the bundle***

Add the bundle to app/AppKernel.php :

```
// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Alsatian\FormBundle\AlsatianFormBundle(),
        );

        // ...
    }

    // ...
}
```

Configuration
=============

[](#configuration)

Add following lines to app/config/config.yml

```
alsatian_form:
    extensible_choice: ~   # To enable Alsatian\FormBundle\Form\ExtensibleChoiceType
    extensible_entity: ~   # To enable Alsatian\FormBundle\Form\ExtensibleEntityType
    extensible_document: ~ # To enable Alsatian\FormBundle\Form\ExtensibleDocumentType

```

For each FormType you can configure a default attr\_class parameter, like this :

```
alsatian_form:
    extensible_choice:
        attr_class: select2 # Adds class="select2" in the HTML select element
    extensible_entity:
        attr_class: select2-entity # Adds class="select2-entity" in the HTML select element
    extensible_document:
        attr_class: select2-document # Adds class="select2-document" in the HTML select element

```

Usage
=====

[](#usage)

To use these FormTypes :

```
    use Alsatian\FormBundle\Form\ExtensibleChoiceType;
    use Alsatian\FormBundle\Form\ExtensibleEntityType;
    use Alsatian\FormBundle\Form\ExtensibleDocumentType;

    // Without route
    $builder->add('extensible_choice', ExtensibleChoiceType::class);
    $builder->add('extensible_entity', ExtensibleEntityType::class,array('class'=>'AppBundle:Article','choice_label'=>'name'));
    $builder->add('extensible_document', ExtensibleDocumentType::class,array('class'=>'AppBundle:Article','choice_label'=>'name'));

    // With route (generate the route defined as 'route' option and renders it as 'data-ajax-url' html attribute)
    $builder->add('extensible_choice', ExtensibleChoiceType::class,array('route'=>'ajax_choices'));
    $builder->add('extensible_entity', ExtensibleEntityType::class,array('route'=>'ajax_entities','class'=>'AppBundle:Article','choice_label'=>'name'));
    $builder->add('extensible_document', ExtensibleDocumentType::class,array('route'=>'ajax_documents','class'=>'AppBundle:Article','choice_label'=>'name'));
```

This will render HTML like :

```

```

The aim of this bundle is only to do the server side work (allowing "extensible" choices). You have to write your own Javescript adapters to get it work with Select2.

As example, how I use it :

```
$(document).ready(function(){
	$('.select2').each(function(){
		var configs={
		        allowClear: true,
		        width:'resolve',
			ajax:{
				data: function (params) {return {q: params.term};},
				dataType:'json',delay: 250,
				processResults: function (data) {
					var dataresults = [];
					$.each(data, function(key, val){
						dataresults.push({id: val[0], text: val[1]});
					});
					return { results: dataresults };
				}
			};
		};

		$(this).select2(configs);
	});
});
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~156 days

Recently: every ~82 days

Total

9

Last Release

936d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/857ec764dde1d854084338bc3d9dd64f9038e6303ec117cc157c54f25a370a59?d=identicon)[Alsatian67](/maintainers/Alsatian67)

---

Top Contributors

[![Alsatian67](https://avatars.githubusercontent.com/u/7631072?v=4)](https://github.com/Alsatian67 "Alsatian67 (128 commits)")[![pascalwacker](https://avatars.githubusercontent.com/u/772008?v=4)](https://github.com/pascalwacker "pascalwacker (2 commits)")[![SosthenG](https://avatars.githubusercontent.com/u/22033159?v=4)](https://github.com/SosthenG "SosthenG (2 commits)")[![BenoitDuffez](https://avatars.githubusercontent.com/u/802209?v=4)](https://github.com/BenoitDuffez "BenoitDuffez (1 commits)")

---

Tags

select2symfonysymfonyselect2

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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