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

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

symfony2admingenerator/form-bundle
==================================

Twig extension introducing new blocks to separate form HTML structure from CSS decorating it and JS enhancing its functionalities.

v2.1.2(2mo ago)431.0k↓50%11MITPHPPHP &gt;=8.1.0

Since Aug 22Pushed 2mo ago6 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (18)Used By (1)

FormBundle
==========

[](#formbundle)

This bundle introduces new twig blocks: `form_js`, `form_js_prototype` and `form_css`.

These blocks seperate form type's HTML structure from CSS decorating the form and JS enhancing its functionalities. Also, the JS block includes `form_js_prototype` block, which holds any initialization logic, which should be called when adding a new field of that type.

If used properly, they make embeding collections of JS-enhanced form types very easy.

1. Installation
===============

[](#1-installation)

#### 1.1 Add dependency to your `composer.json`:

[](#11-add-dependency-to-your-composerjson)

```
"require": {
    "symfony2admingenerator/form-bundle": "@stable"
}
```

And run `composer update` in your project root directory.

#### 1.2 Enable the bundle in your `AppKernel.php`:

[](#12-enable-the-bundle-in-your-appkernelphp)

```

```

2. Usage
========

[](#2-usage)

This bundle adds new twig blocks for your form. In Symfony2 for form type aliased `my_form` you have one block `my_form_widget` where you put everything related to your form type. And that's totally fine for default Symfony2 form types, as they include only basic form elements.

To introduce nice GUI form widgets, we need to style them with CSS and enhance their functionality with JS. So, for these purposes, this bundle introduces new blocks. In our example, that would be `my_form_css` and `my_form_js`.

### Javascript enhanced forms in collections

[](#javascript-enhanced-forms-in-collections)

To make implementing add/remove items to collection of forms easier, we've also added a javascript prototype block, which resides inside the form javascript block. Example:

```
{% block my_form_js %}

	// note: this example uses jQuery
	$field = $("#{{ id }}");

	{% block my_form_js_prototype %}
		// add thick red border to the field
		$field.css({
			'border-color': 'red',
			'border-width': '10px',
			'border-style': 'solid'
		});
	{% block}

{% endblock %}
```

This way we've seperated the javascript selector code from widget initialization code, which now can be used in our collection widget:

```
{% block my_collection_form_js %}

	var $collection = $('#{{ id }}');
	var $addButton 	= $('#{{ id ~ "_add_button" }}');

	var initJS = function($field) {
		// include js prototype code
		{{ form_js(prototype, true) }}
	};

	$addButton.on('click', function(e){
		// here create $newItem and add it to the page
		initJS($newItem);
	});

{% endblock %}
```

> **Note**: this snippet does not include code to add new item, as this is already covered by [How to Embed a Collection of Forms](http://symfony.com/doc/current/cookbook/form/form_collections.html) cookbook.

For example usage study the [AdmingeneratorFormExtensionsBundle](http://github.com/symfony2admingenerator/FormExtensionsBundle) (templates in `Resources/views/Form` directory).

3. Acknowledgements
===================

[](#3-acknowledgements)

The twig extension is copied from [GenemuFormBundle](https://github.com/genemu/GenemuFormBundle/). The names of twig blocks have been changed to not cause conflicts.

The bundle is great, however for our purposes, we only need the Twig Extension, so we decided to extract it and put it into a seperate bundle.

4. Versioning
=============

[](#4-versioning)

Releases will be numbered with the format `major.minor.patch`.

And constructed with the following guidelines.

- Breaking backwards compatibility bumps the major.
- New additions without breaking backwards compatibility bumps the minor.
- Bug fixes and misc changes bump the patch.

For more information on SemVer, please visit [semver.org](http://semver.org) website.

5. Contributing
===============

[](#5-contributing)

This bundle follows branching model described in [A successful git branching model](http://nvie.com/posts/a-successful-git-branching-model/) blog post by Vincent Driessen.

- The `master` branch is used to tag stable releases.
- The `develop` branch is used to develop small changes and merge feature branches into it.
- The `feature-` branches are used to develop features. When ready, submit a PR to `develop` branch.
- The `hotfixes` branch is used to develop fixes to severe bugs in stable releases. When ready, the fix is merged both to `develop` and `master` branches.
- The release branches (eg. `1.1`) are created for each minor release and only patches will be merged into them.

[![Branching model](https://github.com/symfony2admingenerator/FormBundle/raw/master/Resources/doc/branching-model.png)](https://github.com/symfony2admingenerator/FormBundle/raw/master/Resources/doc/branching-model.png)

6. License
==========

[](#6-license)

This bundle is released under the [MIT License](LICENSE) except for the file: `Resources/doc/branching-model.png` by Vincent Driessen, which is released under `Creative Commons BY-SA`.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance84

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 62.8% 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 ~280 days

Total

16

Last Release

83d ago

Major Versions

v1.7.0 → v2.0.02023-02-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1835343?v=4)[Bob van de Vijver](/maintainers/bobvandevijver)[@bobvandevijver](https://github.com/bobvandevijver)

![](https://www.gravatar.com/avatar/62742e225a2fc5b04681425b580d7845cc0d2ac572ab0bfaaee4c7705fafd790?d=identicon)[sescandell](/maintainers/sescandell)

![](https://www.gravatar.com/avatar/52d4597d48c6639975152add5a1dccb0533f51f811cd124fc01a34938bbbf197?d=identicon)[cedriclombardot](/maintainers/cedriclombardot)

![](https://avatars.githubusercontent.com/u/1419884?v=4)[ioleo](/maintainers/ioleo)[@ioleo](https://github.com/ioleo)

---

Top Contributors

[![loostro](https://avatars.githubusercontent.com/u/39191878?v=4)](https://github.com/loostro "loostro (27 commits)")[![tobias-93](https://avatars.githubusercontent.com/u/3901745?v=4)](https://github.com/tobias-93 "tobias-93 (9 commits)")[![sescandell](https://avatars.githubusercontent.com/u/1559970?v=4)](https://github.com/sescandell "sescandell (4 commits)")[![bobvandevijver](https://avatars.githubusercontent.com/u/1835343?v=4)](https://github.com/bobvandevijver "bobvandevijver (3 commits)")

### Embed Badge

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

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

###  Alternatives

[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)[a2lix/auto-form-bundle

Automate form building

873.8M11](/packages/a2lix-auto-form-bundle)[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)[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)[iq2i/storia-bundle

UI Storia bundle

144.6k](/packages/iq2i-storia-bundle)

PHPackages © 2026

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