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)1423.6k↓45.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 1mo ago

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

36

—

LowBetter than 82% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity37

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

891d 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

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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